Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9595 in orxonox.OLD for branches/proxy/src/lib/network


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

userId address spaces adjusted since the proxys are handled differently than clients

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

Legend:

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

    r9588 r9595  
    403403      {
    404404        // each server (proxy and master) have an address space for new network nodes of 1000 nodes
    405         userId = SharedNetworkData::getInstance()->getHostID() * 1000 + 1;
     405        // the first NET_ID_PROXY_MAX are always reserved for proxy servers
     406        userId = SharedNetworkData::getInstance()->getHostID() * 1000 + NET_ID_PROXY_MAX + 1;
    406407
    407408        for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++ )
     
    432433    {
    433434      // determine the network node id
    434       if ( freeSocketSlots.size() > 0 )
    435       {
    436         userId = freeSocketSlots.back();
    437         freeSocketSlots.pop_back();
    438       }
    439       else
     435//       if ( freeSocketSlots.size() > 0 )
     436//       {
     437//         userId = freeSocketSlots.back();
     438//         freeSocketSlots.pop_back();
     439//       }
     440//       else
    440441      {
    441442        userId = 1;
    442443
    443         for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++ )
    444           if ( it->first >= userId )
    445             userId = it->first + 1;
     444        for( int i = 0; i < NET_ID_PROXY_MAX; i++)
     445        {
     446          if( this->peers.find( i) != this->peers.end())
     447            userId = i;
     448          break;
     449        }
     450
     451//         for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++ )
     452//           if ( it->first >= userId )
     453//             userId = it->first + 1;
    446454      }
    447455
     
    521529  // check if the connecting client should reconnect to a proxy server
    522530  if( SharedNetworkData::getInstance()->isMasterServer())
    523     this->peers[userId].handshake->setRedirect(/*this->networkMonitor->isReconnectNextClient()*/false);
     531  {
     532    if( this->networkMonitor->isReconnectNextClient())
     533    {
     534      this->peers[userId].handshake->setRedirect(true);
     535      PRINTF(0)("forwarding client to proxy server because this server is saturated\n");
     536    }
     537  }
    524538
    525539  // the connecting node of course is a client
     
    612626              this->pInfo->userId = SharedNetworkData::getInstance()->getHostID();
    613627
    614 #warning the ip address is not set here because it results in a segfault when connecting to a proxy server => trace this later
    615628//               it->second.ip = it->second.socket->getRemoteAddress();
    616629
     
    828841      if ( ( SharedNetworkData::getInstance()->isMasterServer() ||
    829842             SharedNetworkData::getInstance()->isProxyServerActive() &&  peer->second.isClient() ) &&
    830              ( sync.getUniqueID() >= 1000 || sync.getUniqueID() <= SharedNetworkData::getInstance()->getMaxPlayer() + 1)
    831              /*<= SharedNetworkData::getInstance()->getMaxPlayer() + 1*/) // plus one to handle one client more than the max to redirect it
     843             ( sync.getUniqueID() >= 1000 || sync.getUniqueID() <= SharedNetworkData::getInstance()->getMaxPlayer() + 1 + NET_ID_PROXY_MAX))
    832844        n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset );
    833845      else
  • branches/proxy/src/lib/network/proxy/network_settings.cc

    r9494 r9595  
    8787  // setUniqueID( maxCon+2 ) because we need one id for every handshake
    8888  // and one for handshake to reject client maxCon+1
     89  // NEW: at most there will be
    8990  SharedNetworkData::getInstance()->setNewUniqueID( this->maxPlayer + 2);
    9091}
Note: See TracChangeset for help on using the changeset viewer.