Changeset 9292 in orxonox.OLD for branches/proxy/src/lib
- Timestamp:
- Jul 14, 2006, 1:17:08 PM (18 years ago)
- 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 100 100 else if( pInfo->isProxyServer()) 101 101 { 102 this->localNode->add ProxyServer(pInfo);102 this->localNode->addActiveProxyServer(pInfo); 103 103 // create a new node, since a proxy can connect clients again 104 104 NetworkNode* node = new NetworkNode(pInfo); … … 125 125 node->addClient(pInfo); 126 126 else if( pInfo->isProxyServer()) 127 node->add ProxyServer(pInfo);127 node->addActiveProxyServer(pInfo); 128 128 else if( pInfo->isMasterServer()) 129 129 node->addMasterServer(pInfo); -
branches/proxy/src/lib/network/monitor/network_monitor.h
r9290 r9292 41 41 inline void addClient(NetworkNode* node, PeerInfo* pInfo) { node->addClient(pInfo); } 42 42 /** adds to @param node a network node @param pInfo a new proxy server */ 43 inline void add ProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->addProxyServer(pInfo); }43 inline void addActiveProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->addActiveProxyServer(pInfo); } 44 44 /** adds to @param node a network node @param pInfo a new master server*/ 45 45 inline void addMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->addMasterServer(pInfo); } 46 46 47 47 inline void removeClient(NetworkNode* node, PeerInfo* pInfo) { node->removeClient(pInfo); } 48 inline void remove ProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->removeProxyServer(pInfo); }48 inline void removeActiveProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->removeActiveProxyServer(pInfo); } 49 49 inline void removeMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->removeMasterServer(pInfo); } 50 50 … … 53 53 54 54 /** @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; } 56 58 void getServerWithFreeSlots() { } 57 59 -
branches/proxy/src/lib/network/monitor/network_node.cc
r9289 r9292 48 48 * adds a proxy server 49 49 */ 50 void NetworkNode::add ProxyServer(PeerInfo* node)50 void NetworkNode::addActiveProxyServer(PeerInfo* node) 51 51 { 52 this-> proxyServerList.push_back(node);52 this->activeProxyServerList.push_back(node); 53 53 this->playerNumber++; 54 } 55 56 /** 57 * adds a proxy server 58 */ 59 void NetworkNode::addPassiveProxyServer(PeerInfo* node) 60 { 61 this->passiveProxyServerList.push_back(node); 54 62 } 55 63 … … 85 93 * removes a proxy server 86 94 */ 87 void NetworkNode::remove ProxyServer(PeerInfo* node)95 void NetworkNode::removeActiveProxyServer(PeerInfo* node) 88 96 { 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++) 91 99 { 92 100 if( *it == node) 93 101 { 94 this-> proxyServerList.erase(it);102 this->activeProxyServerList.erase(it); 95 103 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 */ 114 void 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); 96 122 return; 97 123 } … … 137 163 } 138 164 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++) 142 168 { 143 169 PRINT(0)(" - ps, id: %i\n", (*it)->userId); -
branches/proxy/src/lib/network/monitor/network_node.h
r9288 r9292 23 23 24 24 void addClient(PeerInfo* node); 25 void addProxyServer(PeerInfo* node); 25 void addActiveProxyServer(PeerInfo* node); 26 void addPassiveProxyServer(PeerInfo* node); 26 27 void addMasterServer(PeerInfo* node); 27 28 28 29 void removeClient(PeerInfo* node); 29 void removeProxyServer(PeerInfo* node); 30 void removeActiveProxyServer(PeerInfo* node); 31 void removePassiveProxyServer(PeerInfo* node); 30 32 void removeMasterServer(PeerInfo* node); 31 33 … … 46 48 /* network nodes directly connected to this node */ 47 49 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 49 52 std::list<PeerInfo*> masterServerList; //!< list of all master servers in the network (should be 1!! :D) 50 53
Note: See TracChangeset
for help on using the changeset viewer.