Changeset 7729 for code/branches/masterserver/src
- Timestamp:
- Dec 8, 2010, 2:33:54 PM (14 years ago)
- Location:
- code/branches/masterserver/src/libraries/network
- Files:
-
- 1 deleted
- 2 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/masterserver/src/libraries/network/CMakeLists.txt
r7665 r7729 68 68 ADD_SUBDIRECTORY(packet) 69 69 ADD_SUBDIRECTORY(synchronisable) 70 ADD_SUBDIRECTORY(masterserver) 70 71 71 72 ORXONOX_ADD_LIBRARY(network -
code/branches/masterserver/src/libraries/network/MasterServer.cc
r7728 r7729 34 34 namespace orxonox 35 35 { 36 /* singleton stuff */37 //ManageScopedSingleton( MasterServer, ScopeID::Root, false );38 39 36 /* helpers */ 40 37 static void … … 225 222 /* tell people we're now initialized and blocking. */ 226 223 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 } 243 244 } 244 245 } 245 246 /* free the event */247 if( event ) free( event );248 246 249 247 /* done */ … … 262 260 /* register deinitialization */ 263 261 atexit( enet_deinitialize ); 262 263 /* set the quit flag to false */ 264 this->quit = false; 264 265 265 266 /* Bind the server to the default localhost and port ORX_MSERVER_PORT */ … … 282 283 //this->mainlist = new ServerList(); 283 284 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();291 285 } 292 286 -
code/branches/masterserver/src/libraries/network/MasterServer.h
r7728 r7729 38 38 #include <network/packet/Gamestate.h> 39 39 #include <network/packet/Welcome.h> 40 #include <util/Singleton.h>41 40 #include <network/MasterServerProtocol.h> 42 41 … … 51 50 { 52 51 /* singleton */ 53 class MasterServer : public Singleton<MasterServer>52 class MasterServer 54 53 { 55 54 public: … … 57 56 ~MasterServer(); 58 57 59 friend class Singleton<MasterServer>;60 static MasterServer& getInstance(void)61 { return Singleton<MasterServer>::getInstance(); }62 63 /* data fields */64 static MasterServer* singletonPtr_s;65 66 58 private: 67 59 /* methods */ … … 79 71 PeerList *peers; 80 72 73 unsigned int port; 74 bool quit; 75 81 76 /* main routine */ 82 77 int run(); 83 84 78 }; 85 79 } -
code/branches/masterserver/src/libraries/network/MasterServerProtocol.h
r7692 r7729 58 58 59 59 60 #define ORX_MSERVER_PORT 123460 #define ORX_MSERVER_PORT 55566 61 61 62 62
Note: See TracChangeset
for help on using the changeset viewer.