Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9638 in orxonox.OLD for branches/proxy/src/lib


Ignore:
Timestamp:
Jul 31, 2006, 3:34:56 AM (18 years ago)
Author:
patrick
Message:

tests in redirection forcing

Location:
branches/proxy/src/lib/network
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/network_manager.cc

    r9636 r9638  
    173173  // and start the handshake
    174174  this->networkStream->startHandshake();
     175  // create the proxy control
     176  ProxyControl::getInstance();
    175177
    176178  PRINTF(0)("Created Network Client\n");
  • branches/proxy/src/lib/network/network_stream.cc

    r9625 r9638  
    135135
    136136  this->currentState = 0;
     137  this->redirectionUID = NET_ID_MASTER_SERVER;
    137138
    138139  remainingBytesToWriteToDict = Preferences::getInstance()->getInt( "compression", "writedict", 0 );
     
    376377    if( this->bRedirect)
    377378    {
    378       this->handleReconnect( NET_ID_MASTER_SERVER);
     379      this->handleReconnect( this->redirectionUID);
    379380    }
    380381  }
     
    815816void NetworkStream::reconnectToServer(IP address)
    816817{
     818  ///TODO make a redirection struct and push it to the network monitor
    817819  this->networkMonitor->setForcedReconnection(address);
    818   this->handleReconnect( NET_ID_MASTER_SERVER);
     820
     821  // reconnect (depending on how we are connected at the moment)
     822  if ( peers.find( NET_ID_MASTER_SERVER) != peers.end() )
     823    this->redirectionUID = NET_ID_MASTER_SERVER;
     824  else if( peers.find( NET_ID_PROXY_SERVER_01) != peers.end() )
     825    this->redirectionUID = NET_ID_PROXY_SERVER_01;
     826
     827  this->bRedirect = true;
    819828}
    820829
  • branches/proxy/src/lib/network/network_stream.h

    r9604 r9638  
    133133
    134134    bool                       bRedirect;                   //!< true if the master server sent a redirect command
     135    int                        redirectionUID;              //!< uid of the redir host
    135136};
    136137#endif /* _NETWORK_STREAM */
  • branches/proxy/src/lib/network/proxy/proxy_control.cc

    r9637 r9638  
    4747{
    4848  this->setClassID( CL_PROXY_CONTROL, "ProxyControl" );
     49
     50  this->setSynchronized(false);
    4951
    5052  MessageManager::getInstance()->registerMessageHandler( MSGID_PROXY_NEWCLIENT, messageHandlerNewClient, NULL );
     
    319321
    320322  PRINTF(0)("Sending reconnection command to: %i\n", userId);
    321   MessageManager::getInstance()->sendMessage( MSGID_PROXY_COMMAND, data, 3*INTSIZE, RT_ALL_ME, NET_UNASSIGNED, MP_HIGHBANDWIDTH );
     323  MessageManager::getInstance()->sendMessage( MSGID_PROXY_COMMAND, data, 3*INTSIZE, RT_USER, userId, MP_HIGHBANDWIDTH );
    322324}
    323325
     
    360362      assert( Converter::byteArrayToInt( data + INTSIZE, &ipHost) == INTSIZE );
    361363
     364      PRINTF(0)("Got reconnection command from %i: reconnect!\n", senderId);
    362365      // handle it
    363       if( SharedNetworkData::getInstance()->getHostID() == userId &&
    364          (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()))
     366      if( SharedNetworkData::getInstance()->getHostID() == userId)
    365367      {
    366368        NetworkManager::getInstance()->reconnectToServer(IP(ipHost, 9999));
     
    373375
    374376
    375   // part for the master server
    376   if( SharedNetworkData::getInstance()->isMasterServer())
    377   {
    378     // we now create the new player ship and stuff...
    379 //     NetworkGameManager::getInstance()->signalLeftPlayer(leaveClientId);
    380   }
    381   else if(SharedNetworkData::getInstance()->isProxyServerActive())
    382   {
    383 
    384   }
    385377
    386378  return true;
Note: See TracChangeset for help on using the changeset viewer.