Changeset 9270 in orxonox.OLD for branches/proxy
- Timestamp:
- Jul 13, 2006, 2:13:29 PM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/handshake.cc
r9269 r9270 25 25 26 26 27 Handshake::Handshake( bool server, int clientId, int networkGameManagerId, int messageManagerId )27 Handshake::Handshake( int nodeType, int clientId, int networkGameManagerId, int messageManagerId ) 28 28 : Synchronizeable() 29 29 { … … 31 31 this->setClassID(CL_HANDSHAKE, "Handshake"); 32 32 33 this->setIsServer( server);33 this->setIsServer( nodeType == NET_MASTER_SERVER); 34 34 35 35 // register all variable handlers … … 58 58 localState.orxId = _ORXONOX_ID; 59 59 localState.version = _ORXONOX_VERSION; 60 localState.nodeType = NET_CLIENT;60 localState.nodeType = nodeType; 61 61 localState.canDel = 0; 62 62 -
branches/proxy/src/lib/network/handshake.h
r9269 r9270 35 35 36 36 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 ); 38 38 39 39 -
branches/proxy/src/lib/network/network_stream.cc
r9269 r9270 64 64 this->init(); 65 65 /* initialize the references */ 66 this-> type = NET_CLIENT;66 this->nodeType = NET_CLIENT; 67 67 } 68 68 … … 75 75 NetworkStream::NetworkStream( std::string host, int port ) 76 76 { 77 this-> type = NET_CLIENT;77 this->nodeType = NET_CLIENT; 78 78 this->init(); 79 79 this->peers[0].socket = new UdpSocket( host, port ); … … 90 90 NetworkStream::NetworkStream( int port ) 91 91 { 92 this-> type = NET_MASTER_SERVER;92 this->nodeType = NET_MASTER_SERVER; 93 93 this->init(); 94 94 this->serverSocket = new UdpServerSocket(port); … … 173 173 void NetworkStream::startHandshake() 174 174 { 175 Handshake* hs = new Handshake( false);175 Handshake* hs = new Handshake(this->nodeType); 176 176 hs->setUniqueID( 0 ); 177 177 assert( peers[0].handshake == NULL ); … … 229 229 } 230 230 231 if ( this-> type == NET_MASTER_SERVER )231 if ( this->nodeType == NET_MASTER_SERVER ) 232 232 { 233 233 // execute everytthing the master server shoudl do … … 237 237 this->updateConnectionList(); 238 238 } 239 else if( this-> type == NET_PROXY_SERVER)239 else if( this->nodeType == NET_PROXY_SERVER) 240 240 { 241 241 // execute everything the proxy server should do … … 292 292 freeSocketSlots.pop_back(); 293 293 peers[clientId].socket = tempNetworkSocket; 294 peers[clientId].handshake = new Handshake(t rue, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID() );294 peers[clientId].handshake = new Handshake(this->nodeType, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID() ); 295 295 peers[clientId].connectionMonitor = new ConnectionMonitor( clientId ); 296 296 peers[clientId].handshake->setUniqueID(clientId); … … 307 307 308 308 peers[clientId].socket = tempNetworkSocket; 309 peers[clientId].handshake = new Handshake(t rue, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID());309 peers[clientId].handshake = new Handshake(this->nodeType, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID()); 310 310 peers[clientId].handshake->setUniqueID(clientId); 311 311 peers[clientId].connectionMonitor = new ConnectionMonitor( clientId ); … … 437 437 if ( !it->second.handshake->allowDel() ) 438 438 { 439 if ( t ype == NET_CLIENT )439 if ( this->nodeType == NET_CLIENT ) 440 440 { 441 441 SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() ); 442 442 myHostId = SharedNetworkData::getInstance()->getHostID(); 443 444 PRINTF(0)("remote host is a %i\n", it->second.handshake->getRemoteNodeType()); 443 445 444 446 this->networkGameManager = NetworkGameManager::getInstance(); … … 457 459 if ( it->second.handshake->canDel() ) 458 460 { 459 if ( t ype == NET_MASTER_SERVER )461 if ( this->nodeType == NET_MASTER_SERVER ) 460 462 { 461 463 handleNewClient( it->second.userId ); -
branches/proxy/src/lib/network/network_stream.h
r9268 r9270 48 48 49 49 /* 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; } 53 53 // inline bool isActive() const { return this->bActive; } 54 54 inline int getMaxConnections(){ return MAX_CONNECTIONS; } … … 88 88 PeerList peers; //!< list of the network node informations 89 89 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,...) 91 91 int myHostId; //!< the host id of the localhost 92 92
Note: See TracChangeset
for help on using the changeset viewer.