Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 8, 2010, 2:33:54 PM (15 years ago)
Author:
smerkli
Message:

moved some files.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • code/branches/masterserver/src/libraries/network/MasterServer.cc

    r7728 r7729  
    3434namespace orxonox
    3535{
    36   /* singleton stuff */
    37   //ManageScopedSingleton( MasterServer, ScopeID::Root, false );
    38 
    3936  /* helpers */
    4037  static void
     
    225222    /* tell people we're now initialized and blocking. */
    226223    COUT(0) << "MasterServer initialized, waiting for connections.\n";
    227 
    228     /* create an iterator for the loop */
    229     while( enet_host_service( this->server, event, 1000 ) >= 0 )
    230     { /* check what type of event it is and react accordingly */
    231       switch (event->type)
    232       { /* new connection */
    233         case ENET_EVENT_TYPE_CONNECT:
    234           eventConnect( event ); break;
    235 
    236           /* disconnect */
    237         case ENET_EVENT_TYPE_DISCONNECT:
    238           eventDisconnect( event ); break;
    239 
    240           /* incoming data */
    241         case ENET_EVENT_TYPE_RECEIVE: eventData( event ); break;
    242         default: break;
     224   
     225    /* endless loop until we quit */
     226    while( this->quit == false )
     227    {
     228      /* create an iterator for the loop */
     229      while( enet_host_service( this->server, event, 1000 ) >= 0 )
     230      { /* check what type of event it is and react accordingly */
     231        switch (event->type)
     232        { /* new connection */
     233          case ENET_EVENT_TYPE_CONNECT:
     234            eventConnect( event ); break;
     235
     236            /* disconnect */
     237          case ENET_EVENT_TYPE_DISCONNECT:
     238            eventDisconnect( event ); break;
     239
     240            /* incoming data */
     241          case ENET_EVENT_TYPE_RECEIVE: eventData( event ); break;
     242          default: break;
     243        }
    243244      }
    244245    }
    245 
    246     /* free the event */
    247     if( event ) free( event );
    248246
    249247    /* done */
     
    262260    /* register deinitialization */
    263261    atexit( enet_deinitialize );
     262
     263    /* set the quit flag to false */
     264    this->quit = false;
    264265
    265266    /* Bind the server to the default localhost and port ORX_MSERVER_PORT */
     
    282283    //this->mainlist = new ServerList();
    283284    this->peers = new PeerList();
    284     //if( this->mainlist == NULL || this->peers == NULL )
    285     //{ COUT(1) << "Error creating server or peer list.\n";
    286       //exit( EXIT_FAILURE );
    287     //}
    288 
    289     /* run the main method */
    290     run();
    291285  }
    292286
Note: See TracChangeset for help on using the changeset viewer.