Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9270 in orxonox.OLD


Ignore:
Timestamp:
Jul 13, 2006, 2:13:29 PM (18 years ago)
Author:
patrick
Message:

processing the node type through the framework

Location:
branches/proxy/src/lib/network
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/handshake.cc

    r9269 r9270  
    2525
    2626
    27 Handshake::Handshake( bool server, int clientId, int networkGameManagerId, int messageManagerId )
     27Handshake::Handshake( int nodeType, int clientId, int networkGameManagerId, int messageManagerId )
    2828  : Synchronizeable()
    2929{
     
    3131  this->setClassID(CL_HANDSHAKE, "Handshake");
    3232
    33   this->setIsServer(server);
     33  this->setIsServer( nodeType == NET_MASTER_SERVER);
    3434
    3535  // register all variable handlers
     
    5858  localState.orxId = _ORXONOX_ID;
    5959  localState.version = _ORXONOX_VERSION;
    60   localState.nodeType = NET_CLIENT;
     60  localState.nodeType = nodeType;
    6161  localState.canDel = 0;
    6262
  • branches/proxy/src/lib/network/handshake.h

    r9269 r9270  
    3535
    3636  public:
    37     Handshake( bool server, int clientId = 0, int networkGameManagerId = 0, int messageManagerId = 0 );
     37    Handshake( int nodeType, int clientId = 0, int networkGameManagerId = 0, int messageManagerId = 0 );
    3838
    3939
  • branches/proxy/src/lib/network/network_stream.cc

    r9269 r9270  
    6464  this->init();
    6565  /* initialize the references */
    66   this->type = NET_CLIENT;
     66  this->nodeType = NET_CLIENT;
    6767}
    6868
     
    7575NetworkStream::NetworkStream( std::string host, int port )
    7676{
    77   this->type = NET_CLIENT;
     77  this->nodeType = NET_CLIENT;
    7878  this->init();
    7979  this->peers[0].socket = new UdpSocket( host, port );
     
    9090NetworkStream::NetworkStream( int port )
    9191{
    92   this->type = NET_MASTER_SERVER;
     92  this->nodeType = NET_MASTER_SERVER;
    9393  this->init();
    9494  this->serverSocket = new UdpServerSocket(port);
     
    173173void NetworkStream::startHandshake()
    174174{
    175   Handshake* hs = new Handshake(false);
     175  Handshake* hs = new Handshake(this->nodeType);
    176176  hs->setUniqueID( 0 );
    177177  assert( peers[0].handshake == NULL );
     
    229229  }
    230230
    231   if ( this->type == NET_MASTER_SERVER )
     231  if ( this->nodeType == NET_MASTER_SERVER )
    232232  {
    233233    // execute everytthing the master server shoudl do
     
    237237    this->updateConnectionList();
    238238  }
    239   else if( this->type == NET_PROXY_SERVER)
     239  else if( this->nodeType == NET_PROXY_SERVER)
    240240  {
    241241    // execute everything the proxy server should do
     
    292292      freeSocketSlots.pop_back();
    293293      peers[clientId].socket = tempNetworkSocket;
    294       peers[clientId].handshake = new Handshake(true, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID() );
     294      peers[clientId].handshake = new Handshake(this->nodeType, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID() );
    295295      peers[clientId].connectionMonitor = new ConnectionMonitor( clientId );
    296296      peers[clientId].handshake->setUniqueID(clientId);
     
    307307
    308308      peers[clientId].socket = tempNetworkSocket;
    309       peers[clientId].handshake = new Handshake(true, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID());
     309      peers[clientId].handshake = new Handshake(this->nodeType, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID());
    310310      peers[clientId].handshake->setUniqueID(clientId);
    311311      peers[clientId].connectionMonitor = new ConnectionMonitor( clientId );
     
    437437          if ( !it->second.handshake->allowDel() )
    438438          {
    439             if ( type == NET_CLIENT )
     439            if ( this->nodeType == NET_CLIENT )
    440440            {
    441441              SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() );
    442442              myHostId = SharedNetworkData::getInstance()->getHostID();
     443
     444              PRINTF(0)("remote host is a %i\n", it->second.handshake->getRemoteNodeType());
    443445
    444446              this->networkGameManager = NetworkGameManager::getInstance();
     
    457459            if ( it->second.handshake->canDel() )
    458460            {
    459               if ( type == NET_MASTER_SERVER )
     461              if ( this->nodeType == NET_MASTER_SERVER )
    460462              {
    461463                handleNewClient( it->second.userId );
  • branches/proxy/src/lib/network/network_stream.h

    r9268 r9270  
    4848
    4949    /* functions for the localhost settings */
    50     inline bool isMasterServer() const { return (this->type == NET_MASTER_SERVER)? true:false; }
    51     inline bool isProxyServer() const { return (this->type == NET_PROXY_SERVER)? true:false; }
    52     inline bool isClient() const { return (this->type == NET_CLIENT)? true:false; }
     50    inline bool isMasterServer() const { return (this->nodeType == NET_MASTER_SERVER)? true:false; }
     51    inline bool isProxyServer() const { return (this->nodeType == NET_PROXY_SERVER)? true:false; }
     52    inline bool isClient() const { return (this->nodeType == NET_CLIENT)? true:false; }
    5353//     inline bool isActive() const { return this->bActive; }
    5454    inline int getMaxConnections(){ return MAX_CONNECTIONS; }
     
    8888    PeerList                   peers;                       //!< list of the network node informations
    8989
    90     int                        type;                        //!< the type of this host (NET_CLIENT, NET_MASTER_SERVER,...)
     90    int                        nodeType;                    //!< the type of this host (NET_CLIENT, NET_MASTER_SERVER,...)
    9191    int                        myHostId;                    //!< the host id of the localhost
    9292
Note: See TracChangeset for help on using the changeset viewer.