Changeset 9595 in orxonox.OLD for branches/proxy/src/lib/network
- Timestamp:
- Jul 29, 2006, 12:54:09 AM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/network_stream.cc
r9588 r9595 403 403 { 404 404 // 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; 406 407 407 408 for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++ ) … … 432 433 { 433 434 // determine the network node id 434 if ( freeSocketSlots.size() > 0 )435 {436 userId = freeSocketSlots.back();437 freeSocketSlots.pop_back();438 }439 else435 // if ( freeSocketSlots.size() > 0 ) 436 // { 437 // userId = freeSocketSlots.back(); 438 // freeSocketSlots.pop_back(); 439 // } 440 // else 440 441 { 441 442 userId = 1; 442 443 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; 446 454 } 447 455 … … 521 529 // check if the connecting client should reconnect to a proxy server 522 530 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 } 524 538 525 539 // the connecting node of course is a client … … 612 626 this->pInfo->userId = SharedNetworkData::getInstance()->getHostID(); 613 627 614 #warning the ip address is not set here because it results in a segfault when connecting to a proxy server => trace this later615 628 // it->second.ip = it->second.socket->getRemoteAddress(); 616 629 … … 828 841 if ( ( SharedNetworkData::getInstance()->isMasterServer() || 829 842 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)) 832 844 n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset ); 833 845 else -
branches/proxy/src/lib/network/proxy/network_settings.cc
r9494 r9595 87 87 // setUniqueID( maxCon+2 ) because we need one id for every handshake 88 88 // and one for handshake to reject client maxCon+1 89 // NEW: at most there will be 89 90 SharedNetworkData::getInstance()->setNewUniqueID( this->maxPlayer + 2); 90 91 }
Note: See TracChangeset
for help on using the changeset viewer.