Changeset 9653 in orxonox.OLD for branches/proxy/src/lib/network/network_stream.cc
- Timestamp:
- Aug 1, 2006, 12:39:03 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.