Changeset 9470 in orxonox.OLD for branches/proxy/src/lib/network
- Timestamp:
- Jul 25, 2006, 10:23:17 PM (19 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/network_game_manager.cc
r9452 r9470 91 91 bool NetworkGameManager::signalNewPlayer( int userId ) 92 92 { 93 assert( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive());93 assert( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/); 94 94 assert( State::getGameRules() ); 95 95 assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) ); … … 168 168 bool NetworkGameManager::delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId ) 169 169 { 170 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())170 if ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/) 171 171 { 172 172 PRINTF(2)("Recieved DeleteSynchronizeable message from client %d!\n", userId); … … 229 229 bool NetworkGameManager::preferedTeamHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId ) 230 230 { 231 assert( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive());231 assert( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/); 232 232 233 233 int teamId = 0; … … 261 261 void NetworkGameManager::prefereTeam( int teamId ) 262 262 { 263 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())263 if ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/) 264 264 setPreferedTeam( SharedNetworkData::getInstance()->getHostID(), teamId ); 265 265 else … … 305 305 { 306 306 PRINTF(0)("NetworkGameManager::chatMessageHandler %d %d\n", userId, SharedNetworkData::getInstance()->getHostID() ); 307 if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) && userId != SharedNetworkData::getInstance()->getHostID() )307 if ( (SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/) && userId != SharedNetworkData::getInstance()->getHostID() ) 308 308 { 309 309 MessageManager::getInstance()->sendMessage( messageId, data, dataLength, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH ); … … 347 347 assert( Converter::stringToByteArray(message, buf+2*INTSIZE, message.length()+INTSIZE) == message.length()+INTSIZE ); 348 348 349 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())349 if ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/) 350 350 MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+3*INTSIZE, RT_ALL_ME, 0, MP_HIGHBANDWIDTH ); 351 351 else -
branches/proxy/src/lib/network/network_manager.cc
r9467 r9470 131 131 132 132 // create the network stream af 133 this->networkStream = new NetworkStream(NET_PROXY_SERVER_ACTIVE );133 this->networkStream = new NetworkStream(NET_PROXY_SERVER_ACTIVE ); 134 134 // first connect to the master server for synchronization 135 135 this->networkStream->connectToMasterServer(NetworkSettings::getInstance()->getMasterAddr().ipString(), 9999); -
branches/proxy/src/lib/network/network_stream.cc
r9468 r9470 208 208 * @param port: the port number 209 209 */ 210 void NetworkStream::connectToProxyServer(int proxyId, std::string host, int port)210 void NetworkStream::connectToProxyServer(int proxyId, std::string host, int port) 211 211 { 212 212 PRINTF(0)("connect to proxy %s, this is proxyId %i\n", host.c_str(), proxyId); … … 253 253 void NetworkStream::startHandshake(int userId) 254 254 { 255 Handshake* hs = new Handshake( this->pInfo->nodeType);255 Handshake* hs = new Handshake(NET_CLIENT/* this->pInfo->nodeType*/); 256 256 // fake the unique id 257 257 hs->setUniqueID( NET_UID_HANDSHAKE ); … … 323 323 this->updateConnectionList(); 324 324 } 325 else if( this->pInfo->isProxyServerActive())326 {325 // else if( this->pInfo->isProxyServerActive()) 326 // { 327 327 // execute everything the proxy server should do 328 if ( this->clientSocket ) 329 this->clientSocket->update(); 330 if( this->proxySocket) 331 this->proxySocket->update(); 332 333 this->updateConnectionList(); 334 } 328 329 // if ( this->clientSocket ) 330 // this->clientSocket->update(); 331 // if( this->proxySocket) 332 // this->proxySocket->update(); 333 // 334 // this->updateConnectionList(); 335 // } 335 336 else 336 337 { … … 554 555 { 555 556 // make sure this is a client 556 if( this->pInfo->isClient() )557 if( this->pInfo->isClient() || SharedNetworkData::getInstance()->isProxyServerActive()) 557 558 { 558 559 SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() ); … … 752 753 753 754 // if we are a server (both master and proxy servers) and this is not our handshake 754 if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )755 if ( ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/ ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId ) 755 756 continue; 756 757 … … 766 767 767 768 // server fakes uniqueid == 0 for handshake 768 if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) &&769 if ( ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive() */) && 769 770 sync.getUniqueID() <= SharedNetworkData::getInstance()->getMaxPlayer() + 1) // plus one to handle one client more than the max to redirect it 770 771 n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset ); … … 818 819 // now compress the data with the zip library 819 820 int compLength = 0; 820 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())821 if ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/) 821 822 compLength = Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictServer ); 822 823 else … … 936 937 937 938 // if the node we got this unknown sync from is a client we ignore it (since it has no rights to create a new sync) 938 if ( peers[peer->second.userId].isClient() )939 if ( peers[peer->second.userId].isClient() || peers[peer->second.userId].isProxyServerActive()) 939 940 { 940 941 offset += syncDataLength; -
branches/proxy/src/lib/network/peer_info.cc
r9445 r9470 58 58 return PeerInfo::nodeTypeToString( this->nodeType ); 59 59 // the above does the same, and is faster in it. (there is no case where node is uninit i hope!) 60 /*61 switch( this->nodeType)62 {63 case NET_CLIENT:64 return std::string("client");65 case NET_PROXY_SERVER_ACTIVE:66 return std::string("proxy server active");67 case NET_PROXY_SERVER_PASSIVE:68 return std::string("proxy server passive");69 case NET_MASTER_SERVER:70 return std::string("master server");71 }72 73 return std::string("node is uninit");*/74 60 } 75 61 -
branches/proxy/src/lib/network/shared_network_data.h
r9452 r9470 28 28 29 29 /** @returns the next uniqueID free for an object */ 30 inline int getNewUniqueID() { return ( this->nodeType != NET_CLIENT)?this->newUniqueID++:-1; }30 inline int getNewUniqueID() { return ( isMasterServer())?this->newUniqueID++:-1; } 31 31 /** sets the @param newUniqueID: the new offset for the next unique id */ 32 32 inline void setNewUniqueID(int newUniqueID) { this->newUniqueID = newUniqueID; }
Note: See TracChangeset
for help on using the changeset viewer.