Changeset 9637 in orxonox.OLD for branches/proxy/src/lib
- Timestamp:
- Jul 31, 2006, 3:16:35 AM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/monitor/network_monitor.cc
r9625 r9637 238 238 PeerInfo* NetworkMonitor::getPeerByUserId( int userId) 239 239 { 240 PeerInfo* pInfo; 241 std::list<NetworkNode*>::iterator it = this->nodeList.begin(); 242 for(; it != this->nodeList.end(); it++) 243 { 244 pInfo = (*it)->getPeerByUserId(userId); 245 if( pInfo != NULL) 246 return pInfo; 247 } 240 NetworkNode* node = this->getNodeByUserId(userId); 241 if( node != NULL) 242 return node->getPeerInfo(); 243 248 244 return NULL; 249 245 } … … 257 253 { 258 254 std::list<NetworkNode*>::iterator it = this->nodeList.begin(); 255 NetworkNode* node = NULL; 259 256 for(; it != this->nodeList.end(); it++) 260 257 { 261 PRINTF(0)("comparing %i to %i\n", (*it)->getPeerInfo()->userId, userId); 262 if( (*it)->getPeerInfo()->userId == userId) 263 return (*it); 264 } 258 node = (*it)->getNodeByUserId(userId); 259 if( node != NULL) 260 return node; 261 } 262 265 263 return NULL; 266 264 } -
branches/proxy/src/lib/network/monitor/network_node.cc
r9625 r9637 352 352 353 353 354 355 /** 356 * searches for a given NetworkNode 357 * @param userId of the searched node 358 * @returns the PeerInfo of the userId peer 359 */ 360 NetworkNode* 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 354 404 /** 355 405 * debug function … … 362 412 indent[depth] = '\0'; 363 413 364 PRINT(0)("%s + %s, with i p: %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()); 365 415 std::list<NetworkNode*>::const_iterator it; 366 416 if( !this->masterServerList.empty()) -
branches/proxy/src/lib/network/monitor/network_node.h
r9625 r9637 61 61 inline PeerInfo* getPeerInfo() const { return this->peerInfo; } 62 62 63 NetworkNode* getNodeByUserId( int userId); 64 63 65 void debug(int depth) const; 64 66 -
branches/proxy/src/lib/network/proxy/proxy_control.cc
r9625 r9637 137 137 NetworkMonitor* netMon = SharedNetworkData::getInstance()->getNetworkMonitor(); 138 138 NetworkNode* nNode = netMon->getNodeByUserId(senderId); // this gets the proxy server who sent the msg 139 if( nNode == NULL) 140 PRINTF(0)("Couldn't find node %i! Error\n", senderId); 139 141 PeerInfo* pInfo = new PeerInfo(); 140 142 pInfo->bLocal = false; … … 144 146 netMon->addNode(nNode, pInfo); 145 147 146 PRINTF(0)("Got Signal: from %i new player arrived with userId: %i and ip: % i\n", senderId, newClientId, pInfo->ip.ipString().c_str());148 PRINTF(0)("Got Signal: from %i new player arrived with userId: %i and ip: %s on %i\n", senderId, newClientId, pInfo->ip.ipString().c_str(), senderId); 147 149 // part for the master server 148 150 if( SharedNetworkData::getInstance()->isMasterServer())
Note: See TracChangeset
for help on using the changeset viewer.