Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jul 17, 2006, 5:47:32 PM (18 years ago)
Author:
patrick
Message:

proxy server ip synchronizeing bug, nodes get registered

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

Legend:

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

    r9303 r9308  
    2020
    2121#include "proxy/proxy_settings.h"
     22#include "shared_network_data.h"
    2223
    2324#include "network_monitor.h"
     
    5253  this->setSynchronized(false);
    5354
    54   // assuming that the config files are already read we get the proxy servers
    55   std::vector<IPaddress*>* proxyList = ProxySettings::getInstance()->getProxyList();
    56   std::vector<IPaddress*>::iterator it = proxyList->begin();
    57   // create a peer info class and a network node class for each new proxy and add them to the passive list
    58   for(; it < proxyList->end(); it++)
    59   {
    60     PeerInfo* peer = new PeerInfo();
    61     peer->ip = *(*it);
    62     peer->nodeType = NET_PROXY_SERVER_ACTIVE;
    63     peer->userId = -1;
    64 
    65     NetworkNode* node = new NetworkNode(peer);
    66     this->addPassiveProxyServer( this->localNode, peer);
     55  // read in the proxy server list, this is only the case for the master server
     56  if( SharedNetworkData::getInstance()->isMasterServer())
     57  {
     58    // assuming that the config files are already read we get the proxy servers
     59    std::vector<IPaddress*>* proxyList = ProxySettings::getInstance()->getProxyList();
     60    std::vector<IPaddress*>::iterator it = proxyList->begin();
     61    // create a peer info class and a network node class for each new proxy and add them to the passive list
     62    for(; it < proxyList->end(); it++)
     63    {
     64      PeerInfo* peer = new PeerInfo();
     65      peer->ip = *(*it);
     66      peer->nodeType = NET_PROXY_SERVER_ACTIVE;
     67      peer->userId = -1;
     68
     69      NetworkNode* node = new NetworkNode(peer);
     70      this->addNode( node);
     71      this->addPassiveProxyServer( this->localNode, peer);
     72    }
    6773  }
    6874}
     
    111117 * @param ip ip of the new node
    112118 */
    113 void NetworkMonitor::addNode(IPaddress ip)
    114 {}
     119void NetworkMonitor::addNode(IPaddress ip, int nodeType)
     120{
     121  PeerInfo* pInfo = new PeerInfo();
     122  pInfo->nodeType = nodeType;
     123  pInfo->ip = ip;
     124
     125  this->addNode( pInfo);
     126}
    115127
    116128
  • branches/proxy/src/lib/network/monitor/network_monitor.h

    r9300 r9308  
    3434    void removeNetworkNode(NetworkNode* node);
    3535
    36     void addNode(IPaddress ip);
    3736    void addNode(PeerInfo* pInfo);
     37    void addNode(IPaddress ip, int nodeType);
    3838    void addNode(NetworkNode* node) { this->nodeList.push_back(node); }
    3939    void addNode(NetworkNode* node, PeerInfo* pInfo);
  • branches/proxy/src/lib/network/monitor/network_node.cc

    r9300 r9308  
    239239  for(; it != this->masterServerList.end(); it++)
    240240  {
    241     PRINT(0)("     - ms, id: %i\n", (*it)->userId);
    242   }
    243 
    244   PRINT(0)("    proxy servers: %i\n", this->activeProxyServerList.size());
     241    int ip = (*it)->ip.host;
     242    PRINT(0)("     - ms, id: %i (%d.%d.%d.%d:9999)\n", (*it)->userId, (ip & 0x000000FF), (ip & 0x0000FF00) >> 8, (ip & 0x00FF0000) >> 16, (ip & 0xFF000000)>>24);
     243  }
     244
     245  PRINT(0)("    proxy servers active: %i\n", this->activeProxyServerList.size());
    245246  it = this->activeProxyServerList.begin();
    246247  for(; it != this->activeProxyServerList.end(); it++)
    247248  {
    248     PRINT(0)("     - ps, id: %i\n", (*it)->userId);
     249    int ip = (*it)->ip.host;
     250    PRINT(0)("     - ps-a, id: %i (%d.%d.%d.%d:9999)\n", (*it)->userId, (ip & 0x000000FF), (ip & 0x0000FF00) >> 8, (ip & 0x00FF0000) >> 16, (ip & 0xFF000000)>>24);
     251  }
     252
     253  PRINT(0)("    proxy servers passive: %i\n", this->passiveProxyServerList.size());
     254  it = this->passiveProxyServerList.begin();
     255  for(; it != this->passiveProxyServerList.end(); it++)
     256  {
     257    int ip = (*it)->ip.host;
     258    PRINT(0)("     - ps-p, id: %i (%d.%d.%d.%d:9999)\n", (*it)->userId, (ip & 0x000000FF), (ip & 0x0000FF00) >> 8, (ip & 0x00FF0000) >> 16, (ip & 0xFF000000)>>24);
    249259  }
    250260
     
    253263  for(; it != this->clientList.end(); it++)
    254264  {
    255     PRINT(0)("     - client, id: %i\n", (*it)->userId);
    256   }
    257 }
    258 
     265    int ip = (*it)->ip.host;
     266    PRINT(0)("     - client, id: %i (%d.%d.%d.%d:9999)\n", (*it)->userId, (ip & 0x000000FF), (ip & 0x0000FF00) >> 8, (ip & 0x00FF0000) >> 16, (ip & 0xFF000000)>>24);
     267  }
     268}
     269
Note: See TracChangeset for help on using the changeset viewer.