Changeset 9285 in orxonox.OLD for branches/proxy/src
- Timestamp:
- Jul 14, 2006, 10:46:13 AM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/monitor/network_monitor.cc
r9284 r9285 157 157 } 158 158 159 160 void NetworkMonitor::debug() 161 { 162 PRINTF(0)("================================= Network Monitor ========\n"); 163 PRINTF(0)(" Total count of network nodes: %i\n", this->playerNumber); 164 165 } 166 -
branches/proxy/src/lib/network/monitor/network_monitor.h
r9282 r9285 56 56 57 57 void process(); 58 void debug(); 58 59 59 60 -
branches/proxy/src/lib/network/network_stream.cc
r9284 r9285 64 64 this->init(); 65 65 /* initialize the references */ 66 this-> nodeType = NET_CLIENT;66 this->pInfo->nodeType = NET_CLIENT; 67 67 } 68 68 … … 75 75 NetworkStream::NetworkStream( std::string host, int port ) 76 76 { 77 this->nodeType = NET_CLIENT;78 77 this->init(); 78 // init the peers[0] the server to ceonnect to 79 79 this->peers[0].socket = new UdpSocket( host, port ); 80 80 this->peers[0].userId = 0; 81 81 this->peers[0].nodeType = NET_MASTER_SERVER; 82 82 this->peers[0].connectionMonitor = new ConnectionMonitor( 0 ); 83 // and set also the localhost 84 this->pInfo->nodeType = NET_CLIENT; 83 85 } 84 86 … … 90 92 NetworkStream::NetworkStream( int port ) 91 93 { 92 this->nodeType = NET_MASTER_SERVER;93 94 this->init(); 94 95 this->serverSocket = new UdpServerSocket(port); 96 this->pInfo->nodeType = NET_MASTER_SERVER; 95 97 } 96 98 … … 108 110 109 111 this->pInfo = new PeerInfo(); 110 this->pInfo->nodeType = NET_CLIENT;111 112 this->pInfo->userId = 0; 112 113 this->pInfo->lastAckedState = 0; 113 114 this->pInfo->lastRecvedState = 0; 114 115 115 this->myHostId = 0; 116 116 117 this->currentState = 0; 117 118 … … 184 185 void NetworkStream::startHandshake() 185 186 { 186 Handshake* hs = new Handshake(this-> nodeType);187 Handshake* hs = new Handshake(this->pInfo->nodeType); 187 188 hs->setUniqueID( 0 ); 188 189 assert( peers[0].handshake == NULL ); … … 245 246 } 246 247 247 if ( this-> nodeType == NET_MASTER_SERVER )248 if ( this->pInfo->nodeType == NET_MASTER_SERVER ) 248 249 { 249 250 // execute everytthing the master server shoudl do … … 253 254 this->updateConnectionList(); 254 255 } 255 else if( this-> nodeType == NET_PROXY_SERVER)256 else if( this->pInfo->nodeType == NET_PROXY_SERVER) 256 257 { 257 258 // execute everything the proxy server should do … … 311 312 freeSocketSlots.pop_back(); 312 313 peers[clientId].socket = tempNetworkSocket; 313 peers[clientId].handshake = new Handshake(this-> nodeType, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID() );314 peers[clientId].handshake = new Handshake(this->pInfo->nodeType, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID() ); 314 315 peers[clientId].connectionMonitor = new ConnectionMonitor( clientId ); 315 316 peers[clientId].handshake->setUniqueID(clientId); … … 326 327 327 328 peers[clientId].socket = tempNetworkSocket; 328 peers[clientId].handshake = new Handshake(this-> nodeType, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID());329 peers[clientId].handshake = new Handshake(this->pInfo->nodeType, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID()); 329 330 peers[clientId].handshake->setUniqueID(clientId); 330 331 peers[clientId].connectionMonitor = new ConnectionMonitor( clientId ); … … 408 409 { 409 410 if( this->isMasterServer()) 410 PRINT(0)(" Host ist Server with ID: %i\n", this-> myHostId);411 PRINT(0)(" Host ist Server with ID: %i\n", this->pInfo->userId); 411 412 else 412 PRINT(0)(" Host ist Client with ID: %i\n", this-> myHostId);413 PRINT(0)(" Host ist Client with ID: %i\n", this->pInfo->userId); 413 414 414 415 PRINT(0)(" Got %i connected Synchronizeables, showing active Syncs:\n", this->synchronizeables.size()); … … 456 457 if ( !it->second.handshake->allowDel() ) 457 458 { 458 if ( this-> nodeType == NET_CLIENT )459 if ( this->pInfo->nodeType == NET_CLIENT ) 459 460 { 460 461 SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() ); 461 myHostId = SharedNetworkData::getInstance()->getHostID(); 462 463 // PRINTF(0)("remote host is a %i\n", it->second.handshake->getRemoteNodeType()); 462 this->pInfo->userId = SharedNetworkData::getInstance()->getHostID(); 463 464 464 it->second.nodeType = it->second.handshake->getRemoteNodeType(); 465 465 this->networkMonitor->addNode(&it->second); … … 480 480 if ( it->second.handshake->canDel() ) 481 481 { 482 if ( this-> nodeType == NET_MASTER_SERVER )482 if ( this->pInfo->nodeType == NET_MASTER_SERVER ) 483 483 { 484 484 it->second.nodeType = it->second.handshake->getRemoteNodeType(); -
branches/proxy/src/lib/network/network_stream.h
r9284 r9285 48 48 49 49 /* functions for the localhost settings */ 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; }50 inline bool isMasterServer() const { return (this->pInfo->nodeType == NET_MASTER_SERVER)? true:false; } 51 inline bool isProxyServer() const { return (this->pInfo->nodeType == NET_PROXY_SERVER)? true:false; } 52 inline bool isClient() const { return (this->pInfo->nodeType == NET_CLIENT)? true:false; } 53 53 // inline bool isActive() const { return this->bActive; } 54 54 inline int getMaxConnections(){ return MAX_CONNECTIONS; } … … 94 94 95 95 PeerInfo* pInfo; //!< the info about the local peer node (not in the PeerList) 96 int nodeType; //!< the type of this host (NET_CLIENT, NET_MASTER_SERVER,...)97 int myHostId; //!< the host id of the localhost98 96 99 97 std::list<int> freeSocketSlots; //!< list of free sockets (to ensure not to resycle sockets)
Note: See TracChangeset
for help on using the changeset viewer.