Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9601 in orxonox.OLD


Ignore:
Timestamp:
Jul 29, 2006, 10:09:02 AM (18 years ago)
Author:
patrick
Message:

forced reconnections are now registrated and handled

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

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/monitor/network_monitor.h

    r9589 r9601  
    8282    NetworkNode* getNodeByUserId( int userId);
    8383
     84    /* forced reconnection interface */
     85    inline void setForcedReconnection(IP address) { this->bForcedRecon = true; this->forcedReconnection = address;}
     86    inline bool isForcedReconnection() { return this->bForcedRecon; }
     87    inline IP getForcedReconnectionIP() { this->bForcedRecon = false; return this->forcedReconnection; }
     88
    8489
    8590    void toggleGUI();
     
    98103    int                          playerNumber;                 //!< total number of players in the game
    99104    int                          connectionNumber;             //!< total number of connections at this localhost
     105
     106    IP                           forcedReconnection;           //!< ip of a forced reconnection
     107    bool                         bForcedRecon;                 //!< true if there is a forced recon
    100108};
    101109
  • branches/proxy/src/lib/network/network_stream.cc

    r9600 r9601  
    717717  PeerInfo* pInfo = &this->peers[userId];
    718718
     719  IP proxyIP;
     720  if( this->networkMonitor->isForcedReconnection())
     721    proxyIP = this->networkMonitor->getForcedReconnectionIP();
     722  else
     723    proxyIP = pInfo->handshake->getProxy1Address();
     724
    719725  PRINTF(0)("===============================================\n");
    720726  PRINTF(0)("Client is redirected to the other proxy servers\n");
    721727  PRINTF(0)("  user id: %i\n", userId);
    722   PRINTF(0)("  connecting to: %s\n", this->networkMonitor->getFirstChoiceProxy()->ip.ipString().c_str());
     728  PRINTF(0)("  connecting to: %s\n", proxyIP.ipString().c_str());
    723729  PRINTF(0)("===============================================\n");
    724730
     
    726732  pInfo->lastAckedState = 0;
    727733  pInfo->lastRecvedState = 0;
    728 
    729   // temp save the ip address here
    730   IP proxyIP = pInfo->handshake->getProxy1Address();
    731734
    732735  // disconnect from the current server and reconnect to proxy server
     
    748751void NetworkStream::reconnectToServer(IP address)
    749752{
    750 
     753  this->networkMonitor->setForcedReconnection(address);
     754  this->handleReconnect( NET_ID_MASTER_SERVER);
    751755}
    752756
     
    759763void NetworkStream::softReconnectToServer(IP address)
    760764{
    761 
     765  this->networkMonitor->setForcedReconnection(address);
     766  this->handleReconnect( NET_ID_MASTER_SERVER);
    762767}
    763768
Note: See TracChangeset for help on using the changeset viewer.