Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jul 24, 2006, 2:48:23 PM (18 years ago)
Author:
patrick
Message:

handshake server problems by reconnection

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

Legend:

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

    r9422 r9425  
    137137
    138138
    139 
    140139  // start the network game manager
    141140  this->networkStream->createNetworkGameManager();
  • branches/proxy/src/lib/network/network_stream.cc

    r9422 r9425  
    201201{
    202202  int node = this->peers.size();
     203  PRINTF(0)("connect to proxy %s, this is node %i\n", host.c_str(), node);
     204
    203205  this->peers[node].socket = new UdpSocket( host, port );
    204206  this->peers[node].userId = 0;
     
    517519          if ( !it->second.handshake->allowDel() )
    518520          {
    519 
    520             if ( this->pInfo->isClient() )
     521            // make sure this is a client
     522            assert( this->pInfo->isClient());
     523
     524            SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() );
     525            this->pInfo->userId = SharedNetworkData::getInstance()->getHostID();
     526
     527            it->second.nodeType = it->second.handshake->getRemoteNodeType();
     528            it->second.ip = it->second.socket->getRemoteAddress();
     529              // add the new server to the nodes list (it can be a NET_MASTER_SERVER or NET_PROXY_SERVER)
     530            this->networkMonitor->addNode(&it->second);
     531              // get proxy 1 address and add it
     532            this->networkMonitor->addNode(it->second.handshake->getProxy1Address(), NET_PROXY_SERVER_ACTIVE);
     533              // get proxy 2 address and add it
     534            this->networkMonitor->addNode(it->second.handshake->getProxy2Address(), NET_PROXY_SERVER_ACTIVE);
     535
     536              // now check if the server accepted the connection
     537            if( !it->second.handshake->redirect())
    521538            {
    522               SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() );
    523               this->pInfo->userId = SharedNetworkData::getInstance()->getHostID();
    524 
    525               it->second.nodeType = it->second.handshake->getRemoteNodeType();
    526               it->second.ip = it->second.socket->getRemoteAddress();
    527               // add the new server to the nodes list (it can be a NET_MASTER_SERVER or NET_PROXY_SERVER)
    528               this->networkMonitor->addNode(&it->second);
    529               // get proxy 1 address and add it
    530               this->networkMonitor->addNode(it->second.handshake->getProxy1Address(), NET_PROXY_SERVER_ACTIVE);
    531               // get proxy 2 address and add it
    532               this->networkMonitor->addNode(it->second.handshake->getProxy2Address(), NET_PROXY_SERVER_ACTIVE);
    533 
    534               // now check if the server accepted the connection
    535               if( !it->second.handshake->redirect())
    536               {
    537539                // create the new network game manager and init it
    538                 this->networkGameManager = NetworkGameManager::getInstance();
    539                 this->networkGameManager->setUniqueID( it->second.handshake->getNetworkGameManagerId() );
     540              this->networkGameManager = NetworkGameManager::getInstance();
     541              this->networkGameManager->setUniqueID( it->second.handshake->getNetworkGameManagerId() );
    540542              // init the new message manager
    541                 MessageManager::getInstance()->setUniqueID( it->second.handshake->getMessageManagerId() );
    542 
    543                 PRINT(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId());
    544                 it->second.handshake->del();
    545               }
    546               else
    547                 this->handleReconnect( it->second.userId);
    548 
     543              MessageManager::getInstance()->setUniqueID( it->second.handshake->getMessageManagerId() );
     544
     545              PRINT(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId());
     546              it->second.handshake->del();
    549547            }
    550548            else
    551               assert(false);
    552 
    553 
     549              this->handleReconnect( it->second.userId);
    554550
    555551          }
     
    623619  // reject the server
    624620  pInfo->handshake->doReject( "redirected to different server");
     621  pInfo->handshake->del();
    625622
    626623  // flush the old synchronization states, since the numbering could be completely different
     
    634631//   pInfo->socket->reconnectToServer( proxyIP.ipString(), proxyIP.port());
    635632  this->handleDisconnect( userId);
    636 //   this->connectToProxyServer(proxyIP.ipString(), 9999);
     633  this->connectToProxyServer(proxyIP.ipString(), 9999);
    637634#warning the ports are not yet integrated correctly in the ip class
    638635
    639636  // and restart the handshake
    640 //   this->startHandshake( userId);
     637  this->startHandshake( userId);
    641638}
    642639
Note: See TracChangeset for help on using the changeset viewer.