Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 31, 2006, 3:16:35 AM (18 years ago)
Author:
patrick
Message:

the node registration now works perfectly and hirarchicaly

File:
1 edited

Legend:

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

    r9625 r9637  
    352352
    353353
     354
     355/**
     356 * searches for a given NetworkNode
     357 * @param userId of the searched node
     358 * @returns the PeerInfo of the userId peer
     359 */
     360NetworkNode* NetworkNode::getNodeByUserId( int userId)
     361{
     362  if( this->peerInfo->userId == userId)
     363    return this;
     364
     365
     366  NetworkNode* node = NULL;
     367  std::list<NetworkNode*>::iterator it = this->masterServerList.begin();
     368
     369  for(; it != this->masterServerList.end(); it++)
     370  {
     371    node = (*it)->getNodeByUserId(userId);
     372    if( node != NULL)
     373      return node;
     374  }
     375
     376  it = this->activeProxyServerList.begin();
     377  for(; it != this->activeProxyServerList.end(); it++)
     378  {
     379    node = (*it)->getNodeByUserId(userId);
     380    if( node != NULL)
     381      return node;
     382  }
     383
     384  it = this->passiveProxyServerList.begin();
     385  for(; it != this->passiveProxyServerList.end(); it++)
     386  {
     387    node = (*it)->getNodeByUserId(userId);
     388    if( node != NULL)
     389      return node;
     390  }
     391
     392  it = this->clientList.begin();
     393  for(; it != this->clientList.end(); it++)
     394  {
     395    node = (*it)->getNodeByUserId(userId);
     396    if( node != NULL)
     397      return node;
     398  }
     399
     400  return NULL;
     401}
     402
     403
    354404/**
    355405 * debug function
     
    362412  indent[depth] = '\0';
    363413
    364   PRINT(0)("%s + %s, with ip: %s\n", indent,  this->peerInfo->getNodeTypeString().c_str(), this->peerInfo->ip.ipString().c_str());
     414  PRINT(0)("%s + %s, with id %i and ip: %s\n", indent, this->peerInfo->getNodeTypeString().c_str(), this->peerInfo->userId, this->peerInfo->ip.ipString().c_str());
    365415  std::list<NetworkNode*>::const_iterator it;
    366416  if( !this->masterServerList.empty())
Note: See TracChangeset for help on using the changeset viewer.