Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 8, 2010, 5:13:03 PM (13 years ago)
Author:
smerkli
Message:

made mastserserver mode non-blocking

File:
1 edited

Legend:

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

    r7739 r7743  
    220220    }
    221221
    222     /* tell people we're now initialized and blocking. */
    223     COUT(0) << "MasterServer initialized, waiting for connections.\n";
    224222   
    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         }
    244       }
     223    /* create an iterator for the loop */
     224    enet_host_service( this->server, event, 100 );
     225
     226    /* check what type of event it is and react accordingly */
     227    switch (event->type)
     228    { /* new connection */
     229      case ENET_EVENT_TYPE_CONNECT:
     230        eventConnect( event ); break;
     231
     232        /* disconnect */
     233      case ENET_EVENT_TYPE_DISCONNECT:
     234        eventDisconnect( event ); break;
     235
     236        /* incoming data */
     237      case ENET_EVENT_TYPE_RECEIVE: eventData( event ); break;
     238      default: break;
    245239    }
    246240
     
    283277    //this->mainlist = new ServerList();
    284278    this->peers = new PeerList();
     279
     280    /* tell people we're now initialized */
     281    COUT(0) << "MasterServer initialized, waiting for connections.\n";
    285282  }
    286283
Note: See TracChangeset for help on using the changeset viewer.