Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9287 in orxonox.OLD


Ignore:
Timestamp:
Jul 14, 2006, 11:18:17 AM (18 years ago)
Author:
patrick
Message:

now testing the network monitor

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

Legend:

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

    r9286 r9287  
    4040  this->networkStream = networkStream;
    4141  this->playerNumber = 0;
     42  // create the localnode, init it and add it to the nodes list
    4243  this->localNode = new NetworkNode( this->networkStream->getPeerInfo());
     44  this->addNode(this->localNode);
    4345
    4446  this->setSynchronized(false);
     
    101103    this->localNode->addMasterServer(pInfo);
    102104}
     105
     106
     107/**
     108 * adds a network node to the local node
     109 *  @param node node to add to
     110 *  @param pInfo node information
     111 */
     112void NetworkMonitor::addNode(NetworkNode* node, PeerInfo* pInfo)
     113{
     114  if( node == NULL)
     115    return;
     116
     117  if( pInfo->isClient())
     118    node->addClient(pInfo);
     119  else if( pInfo->isProxyServer())
     120    node->addProxyServer(pInfo);
     121  else if( pInfo->isMasterServer())
     122    node->addMasterServer(pInfo);
     123}
     124
    103125
    104126/**
     
    166188  PRINTF(0)("================================= Network Monitor ========\n");
    167189  PRINTF(0)(" I am: %s\n", this->localNode->getPeerInfo()->getNodeTypeString().c_str());
    168   PRINTF(0)(" Total count of network nodes: %i\n", this->playerNumber);
     190  PRINTF(0)(" Total count of network connections: %i\n", this->playerNumber);
     191
     192  std::list<NetworkNode*>::iterator it = this->nodeList.begin();
     193  for(; it != this->nodeList.end(); it++)
     194  {
     195    (*it)->debug();
     196  }
     197
    169198  PRINTF(0)("==========================================================\n");
    170199//   PRINTF(0)(" Currently got %i");
  • branches/proxy/src/lib/network/monitor/network_monitor.h

    r9285 r9287  
    3535
    3636    void addNode(PeerInfo* pInfo);
    37     void addNode(NetworkNode* node, PeerInfo* pInfo) {}
     37    void addNode(NetworkNode* node) { this->nodeList.push_back(node); }
     38    void addNode(NetworkNode* node, PeerInfo* pInfo);
    3839
    3940    /** adds to @param node a network node @param pInfo a new client */
  • branches/proxy/src/lib/network/network_stream.cc

    r9286 r9287  
    235235  if( this->networkMonitor == NULL)
    236236    this->networkMonitor = new NetworkMonitor(this);
    237   // and let it process some data
    238   this->networkMonitor->process();
    239237
    240238
     
    485483              {
    486484                it->second.nodeType = it->second.handshake->getRemoteNodeType();
     485                this->networkMonitor->addNode(&it->second);
    487486
    488487                handleNewClient( it->second.userId );
Note: See TracChangeset for help on using the changeset viewer.