Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 26, 2006, 10:12:26 AM (18 years ago)
Author:
patrick
Message:

working on the segfault when clients are redirected to a synchronized proxy server

File:
1 edited

Legend:

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

    r9479 r9481  
    367367
    368368/**
    369  * if we are a NET_MASTER_SERVER or NET_PROXY_SERVER_ACTIVE update the connection list to accept new
    370  * connections (clients) also start the handsake for the new clients
     369 * @brief handles incoming connections
     370 *
     371 * if we are a NET_MASTER_SERVER or NET_PROXY_SERVER_ACTIVE update the connection list to accept new connections (clients)
     372 * start and initialize the handsake for the new clients
    371373 */
    372374void NetworkStream::updateConnectionList( )
     
    401403      peers[userId].socket = tempNetworkSocket;
    402404      peers[userId].nodeType = NET_CLIENT;
     405
     406      // handle the newly connected client
    403407      this->handleConnect(userId);
    404408
     
    433437      peers[userId].socket = tempNetworkSocket;
    434438      peers[userId].nodeType = NET_PROXY_SERVER_ACTIVE;
     439
     440      // handle the newly connected proxy server
    435441      this->handleConnect(userId);
    436442
    437       PRINTF(0)("New Proxy: %d\n", userId);
     443      PRINTF(0)("New proxy connected: %d\n", userId);
    438444    }
    439445  }
     
    469475
    470476
     477/**
     478 * this handles new connections
     479 * @param userId: the id of the new user node
     480 */
    471481void NetworkStream::handleConnect( int userId)
    472482{
     
    480490  PRINTF(0)("num sync: %d\n", synchronizeables.size());
    481491
    482     // get the proxy server informations and write them to the handshake, if any (proxy)
     492  // get the proxy server informations and write them to the handshake, if any (proxy)
    483493  assert( this->networkMonitor != NULL);
    484494  PeerInfo* pi = this->networkMonitor->getFirstChoiceProxy();
     
    491501    peers[userId].handshake->setProxy2Address( pi->ip);
    492502
    493     // check if the connecting client should reconnect to a proxy server
     503  // check if the connecting client should reconnect to a proxy server
    494504  peers[userId].handshake->setRedirect(this->networkMonitor->isReconnectNextClient());
    495505
    496     // the connecting node of course is a client
     506  // the connecting node of course is a client
    497507  peers[userId].ip = peers[userId].socket->getRemoteAddress();
    498508}
    499509
    500510
     511
     512/**
     513 * some debug output
     514 */
    501515void NetworkStream::debug()
    502516{
     
    564578            if(  SharedNetworkData::getInstance()->isClient() || SharedNetworkData::getInstance()->isProxyServerActive() && it->second.isMasterServer())
    565579            {
     580              PRINTF(0)("Handshake: i am in client role\n");
     581
    566582              SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() );
    567583              this->pInfo->userId = SharedNetworkData::getInstance()->getHostID();
     
    569585              it->second.ip = it->second.socket->getRemoteAddress();
    570586
    571 //              it->second.nodeType = it->second.handshake->getRemoteNodeType();
    572 //              it->second.ip = it->second.socket->getRemoteAddress();
     587              // it->second.nodeType = it->second.handshake->getRemoteNodeType();
     588              // it->second.ip = it->second.socket->getRemoteAddress();
    573589              // add the new server to the nodes list (it can be a NET_MASTER_SERVER or NET_PROXY_SERVER)
    574590              this->networkMonitor->addNode(&it->second);
     
    616632              else if ( SharedNetworkData::getInstance()->isProxyServerActive() && it->second.isClient() )
    617633              {
     634                PRINTF(0)("Handshake: i am in server role\n");
     635
    618636                it->second.ip = it->second.socket->getRemoteAddress();
    619637
Note: See TracChangeset for help on using the changeset viewer.