Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9292 in orxonox.OLD


Ignore:
Timestamp:
Jul 14, 2006, 1:17:08 PM (18 years ago)
Author:
patrick
Message:

seperating the proxy servers in passive and active

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

Legend:

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

    r9290 r9292  
    100100  else if( pInfo->isProxyServer())
    101101  {
    102     this->localNode->addProxyServer(pInfo);
     102    this->localNode->addActiveProxyServer(pInfo);
    103103    // create a new node, since a proxy can connect clients again
    104104    NetworkNode* node = new NetworkNode(pInfo);
     
    125125    node->addClient(pInfo);
    126126  else if( pInfo->isProxyServer())
    127     node->addProxyServer(pInfo);
     127    node->addActiveProxyServer(pInfo);
    128128  else if( pInfo->isMasterServer())
    129129    node->addMasterServer(pInfo);
  • branches/proxy/src/lib/network/monitor/network_monitor.h

    r9290 r9292  
    4141    inline void addClient(NetworkNode* node, PeerInfo* pInfo) { node->addClient(pInfo); }
    4242    /** adds to @param node a network node @param pInfo a new proxy server */
    43     inline void addProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->addProxyServer(pInfo); }
     43    inline void addActiveProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->addActiveProxyServer(pInfo); }
    4444    /** adds to @param node a network node @param pInfo a new master server*/
    4545    inline void addMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->addMasterServer(pInfo); }
    4646
    4747    inline void removeClient(NetworkNode* node, PeerInfo* pInfo) { node->removeClient(pInfo); }
    48     inline void removeProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->removeProxyServer(pInfo); }
     48    inline void removeActiveProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->removeActiveProxyServer(pInfo); }
    4949    inline void removeMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->removeMasterServer(pInfo); }
    5050
     
    5353
    5454    /** @returns true if there are still free network slots available */
    55     inline bool gotFreeSlots() { return (this->playerNumber < NET_MAX_CONNECTIONS)?true:false; }
     55    inline bool gotFreeSlots() { return (this->localNode->getPlayerNumber() < NET_MAX_CONNECTIONS)?true:false; }
     56    /** @param node node to be checked for slots @returns true if there are still free network slots available at this node */
     57    inline bool gorFreeSlots(NetworkNode* node) { return (node->getPlayerNumber() < NET_MAX_CONNECTIONS)?true:false; }
    5658    void getServerWithFreeSlots() { }
    5759
  • branches/proxy/src/lib/network/monitor/network_node.cc

    r9289 r9292  
    4848 * adds a proxy server
    4949 */
    50 void NetworkNode::addProxyServer(PeerInfo* node)
     50void NetworkNode::addActiveProxyServer(PeerInfo* node)
    5151{
    52   this->proxyServerList.push_back(node);
     52  this->activeProxyServerList.push_back(node);
    5353  this->playerNumber++;
     54}
     55
     56/**
     57 * adds a proxy server
     58 */
     59void NetworkNode::addPassiveProxyServer(PeerInfo* node)
     60{
     61  this->passiveProxyServerList.push_back(node);
    5462}
    5563
     
    8593 * removes a proxy server
    8694 */
    87 void NetworkNode::removeProxyServer(PeerInfo* node)
     95void NetworkNode::removeActiveProxyServer(PeerInfo* node)
    8896{
    89   std::list<PeerInfo*>::iterator it = this->proxyServerList.begin();
    90   for(; it != this->proxyServerList.end(); it++)
     97  std::list<PeerInfo*>::iterator it = this->activeProxyServerList.begin();
     98  for(; it != this->activeProxyServerList.end(); it++)
    9199  {
    92100    if( *it == node)
    93101    {
    94       this->proxyServerList.erase(it);
     102      this->activeProxyServerList.erase(it);
    95103      this->playerNumber--;
     104      return;
     105    }
     106  }
     107
     108  PRINTF(2)("Could not remove proxy server from the list, very strange...");
     109}
     110
     111/**
     112 * removes a proxy server
     113 */
     114void NetworkNode::removePassiveProxyServer(PeerInfo* node)
     115{
     116  std::list<PeerInfo*>::iterator it = this->passiveProxyServerList.begin();
     117  for(; it != this->passiveProxyServerList.end(); it++)
     118  {
     119    if( *it == node)
     120    {
     121      this->passiveProxyServerList.erase(it);
    96122      return;
    97123    }
     
    137163  }
    138164
    139   PRINT(0)("    proxy servers: %i\n", this->proxyServerList.size());
    140   it = this->proxyServerList.begin();
    141   for(; it != this->proxyServerList.end(); it++)
     165  PRINT(0)("    proxy servers: %i\n", this->activeProxyServerList.size());
     166  it = this->activeProxyServerList.begin();
     167  for(; it != this->activeProxyServerList.end(); it++)
    142168  {
    143169    PRINT(0)("     - ps, id: %i\n", (*it)->userId);
  • branches/proxy/src/lib/network/monitor/network_node.h

    r9288 r9292  
    2323
    2424    void addClient(PeerInfo* node);
    25     void addProxyServer(PeerInfo* node);
     25    void addActiveProxyServer(PeerInfo* node);
     26    void addPassiveProxyServer(PeerInfo* node);
    2627    void addMasterServer(PeerInfo* node);
    2728
    2829    void removeClient(PeerInfo* node);
    29     void removeProxyServer(PeerInfo* node);
     30    void removeActiveProxyServer(PeerInfo* node);
     31    void removePassiveProxyServer(PeerInfo* node);
    3032    void removeMasterServer(PeerInfo* node);
    3133
     
    4648    /* network nodes directly connected to this node */
    4749    std::list<PeerInfo*>         clientList;                   //!< list of all clients in the network
    48     std::list<PeerInfo*>         proxyServerList;              //!< list of all proxy servers in the network
     50    std::list<PeerInfo*>         activeProxyServerList;        //!< list of all proxy servers in the network
     51    std::list<PeerInfo*>         passiveProxyServerList;       //!< list of all proxy servers in the network
    4952    std::list<PeerInfo*>         masterServerList;             //!< list of all master servers in the network (should be 1!! :D)
    5053
Note: See TracChangeset for help on using the changeset viewer.