- Timestamp:
- Aug 1, 2006, 12:39:03 AM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/message_manager.cc
r9652 r9653 239 239 outgoingMessageQueue[userId].toAck.push_back( number ); 240 240 241 // PRINTF(0)("got message with type: %i\n", messageType); 241 242 assert( i + messageLength <= length ); 242 243 // make sure there is a message handler for this message type 243 assert( messageHandlerMap.find( (MessageType)messageType ) == messageHandlerMap.end());244 assert( messageHandlerMap.find( (MessageType)messageType ) != messageHandlerMap.end()); 244 245 245 246 … … 453 454 recieverType == RT_ALL_BUT_ME || 454 455 recieverType == RT_USER && it->first == reciever || 455 recieverType == RT_USER && reciever == NET_ID_MASTER_SERVER && !getNetworkStream()->isUserMasterServer( it->first ) || // special case: forward456 recieverType == RT_USER && reciever == NET_ID_MASTER_SERVER && !getNetworkStream()->isUserMasterServer( it->first ) || //(*) 456 457 recieverType == RT_NOT_USER && it->first != reciever || 457 458 recieverType == RT_SERVER && getNetworkStream()->isUserMasterServer( it->first ) || 458 459 recieverType == RT_SERVER && getNetworkStream()->isUserProxyServerActive( it->first ) 459 ) 460 )// (*) special case: forward 460 461 { 461 462 NetworkMessage msg; -
branches/proxy/src/lib/network/network_manager.cc
r9652 r9653 38 38 39 39 SHELL_COMMAND(debug, NetworkManager, debug); 40 SHELL_COMMAND(redirTest, NetworkManager, setRedirectionTest); 41 40 42 41 43 … … 142 144 143 145 // then start the server 144 //this->networkStream->createServer( port, port + 1, port + 2);146 this->networkStream->createServer( port, port + 1, port + 2); 145 147 146 148 // and to the other proxy servers also, this would be very nice if its works … … 232 234 PRINT(0)("===========================================\n"); 233 235 } 236 237 238 void NetworkManager::setRedirectionTest() 239 { 240 this->networkStream->setRedirectionTest(); 241 } -
branches/proxy/src/lib/network/network_manager.h
r9600 r9653 46 46 void debug(); 47 47 48 void setRedirectionTest(); 49 50 48 51 49 52 private: -
branches/proxy/src/lib/network/network_stream.cc
r9652 r9653 390 390 this->handleDownstream( tick ); 391 391 this->handleUpstream( tick ); 392 393 if( this->bSoftRedirect) 394 this->softReconnectToServer(0, IP("localhost", 10001)); 392 395 } 393 396 … … 481 484 userId = 1; 482 485 486 // find an empty slot within the range 483 487 for( int i = 0; i < NET_ID_PROXY_MAX; i++) 484 488 { 485 if( this->peers.find( i) != this->peers.end()) 489 if( this->peers.find( i) == this->peers.end()) 490 { 486 491 userId = i; 487 break; 492 break; 493 } 488 494 } 489 userId++;490 495 491 496 // for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++ ) … … 832 837 /** 833 838 * softly reconnecting to another server 839 * @param serverUserId the id of the client 834 840 * @param address of the new server 835 841 */ 836 void NetworkStream::softReconnectToServer(IP address) 837 { 838 this->networkMonitor->setForcedReconnection(address); 839 this->handleReconnect( NET_ID_MASTER_SERVER); 842 void NetworkStream::softReconnectToServer(int serverUserId, IP address) 843 { 844 // this->networkMonitor->setForcedReconnection(address); 845 // this->handleReconnect( NET_ID_MASTER_SERVER); 846 847 // create the new udp socket and open the connection to the soft connection port 848 NetworkSocket* newSocket = new UdpSocket(address.ipString(), 10001); 849 850 // delete the synchronization state of this client for all syncs 851 for ( SynchronizeableList::iterator it2 = synchronizeables.begin(); it2 != synchronizeables.end(); it2++ ) { 852 (*it2)->cleanUpUser( serverUserId ); 853 } 854 855 // temp save the old socket 856 NetworkSocket* oldSocket = this->peers[serverUserId].socket; 857 858 // now integrate the new socket 859 this->peers[serverUserId].socket = newSocket; 860 861 return; 862 863 // now remove the old socket 864 oldSocket->disconnectServer(); 865 delete oldSocket; 866 867 // replace the old connection monitor 868 if ( this->peers[serverUserId].connectionMonitor ) 869 delete this->peers[serverUserId].connectionMonitor; 870 this->peers[serverUserId].connectionMonitor = new ConnectionMonitor(serverUserId); 871 872 // remove old node from the network monitor 873 this->networkMonitor->removeNode(&this->peers[serverUserId]); 874 875 this->bSoftRedirect = false; 840 876 } 841 877 … … 859 895 this->peers[userId].connectionMonitor = NULL; 860 896 861 897 // delete the synchronization state of this client for all syncs 862 898 for ( SynchronizeableList::iterator it2 = synchronizeables.begin(); it2 != synchronizeables.end(); it2++ ) { 863 899 (*it2)->cleanUpUser( userId ); … … 872 908 this->peers.erase( userId); 873 909 } 874 875 910 876 911 -
branches/proxy/src/lib/network/network_stream.h
r9638 r9653 50 50 51 51 void reconnectToServer(IP address); 52 void softReconnectToServer( IP address);52 void softReconnectToServer(int serverUserId, IP address); 53 53 54 54 … … 75 75 inline PeerInfo* getPeerInfo() { return this->pInfo; } 76 76 inline PeerList getPeerInfoList() { return this->peers; } 77 78 inline void setRedirectionTest() { this->bSoftRedirect = true; } 77 79 78 80 /* data processing*/ … … 104 106 void handleReconnect( int userId ); 105 107 void handleDisconnect( int userId ); 108 void handleSoftDisconnect( int userId); 106 109 107 110 void writeToNewDict( byte * data, int length, bool upstream ); … … 134 137 bool bRedirect; //!< true if the master server sent a redirect command 135 138 int redirectionUID; //!< uid of the redir host 139 bool bSoftRedirect; //!< tsting 136 140 }; 137 141 #endif /* _NETWORK_STREAM */ -
branches/proxy/src/lib/network/synchronizeable.cc
r9636 r9653 126 126 int Synchronizeable::getStateDiff( int userId, byte* data, int maxLength, int stateId, int fromStateId, int priorityTH ) 127 127 { 128 // make sure this user has his history128 // make sure this user has his history or resize for new clients 129 129 if ( (int)sentStates.size() <= userId ) 130 130 sentStates.resize( userId+1 ); … … 133 133 int neededSize = 0; 134 134 135 // calculate the needed space for network packet by summing up 135 136 for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ ) 136 137 { -
branches/proxy/src/lib/network/udp_socket.h
r9406 r9653 41 41 42 42 private: 43 void init(); 44 45 bool writeRawPacket( byte * data, int length ); 46 bool checkUdpCmd( byte udpCmd ); 47 bool checkRandomByte( byte rndByte ); 48 byte generateNewRandomByte(); 49 50 51 private: 43 52 UdpServerSocket * serverSocket; //!< will get packets here 44 53 int userId; //!< user id used by serverSocket … … 47 56 48 57 byte randomByte; //!< contains random bytes & 0xFC 49 50 bool writeRawPacket( byte * data, int length );51 bool checkUdpCmd( byte udpCmd );52 bool checkRandomByte( byte rndByte );53 byte generateNewRandomByte();54 55 void init();56 57 58 }; 58 59
Note: See TracChangeset
for help on using the changeset viewer.