Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

moved some files.

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  
    6868ADD_SUBDIRECTORY(packet)
    6969ADD_SUBDIRECTORY(synchronisable)
     70ADD_SUBDIRECTORY(masterserver)
    7071
    7172ORXONOX_ADD_LIBRARY(network
  • 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
  • code/branches/masterserver/src/libraries/network/MasterServer.h

    r7728 r7729  
    3838#include <network/packet/Gamestate.h>
    3939#include <network/packet/Welcome.h>
    40 #include <util/Singleton.h>
    4140#include <network/MasterServerProtocol.h>
    4241
     
    5150{
    5251  /* singleton */
    53   class MasterServer: public Singleton<MasterServer>
     52  class MasterServer
    5453  {
    5554    public:
     
    5756      ~MasterServer();
    5857
    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    
    6658    private:
    6759      /* methods */
     
    7971      PeerList *peers;
    8072
     73      unsigned int port;
     74      bool quit;
     75
    8176      /* main routine */
    8277      int run();
    83 
    8478  };
    8579}
  • code/branches/masterserver/src/libraries/network/MasterServerProtocol.h

    r7692 r7729  
    5858
    5959
    60 #define ORX_MSERVER_PORT 1234
     60#define ORX_MSERVER_PORT 55566
    6161
    6262
Note: See TracChangeset for help on using the changeset viewer.