Changeset 9419 in orxonox.OLD for branches/proxy
- Timestamp:
- Jul 24, 2006, 1:27:05 PM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/network_stream.cc
r9406 r9419 80 80 // init the shared network data 81 81 SharedNetworkData::getInstance()->setHostID(0); 82 // SharedNetworkData::getInstance()->setNodeType(NET_MASTER_SERVER);83 82 break; 84 83 … … 86 85 // init the shared network data 87 86 SharedNetworkData::getInstance()->setHostID(0); 88 // SharedNetworkData::getInstance()->setNodeType(NET_PROXY_SERVER_ACTIVE);89 87 break; 90 88 case NET_PROXY_SERVER_PASSIVE: 91 89 // init the shared network data 92 90 SharedNetworkData::getInstance()->setHostID(0); 93 // SharedNetworkData::getInstance()->setNodeType(NET_PROXY_SERVER_PASSIVE);94 91 break; 95 92 case NET_CLIENT: 96 // SharedNetworkData::getInstance()->setNodeType(NET_CLIENT);97 93 break; 98 94 } … … 323 319 if ( peers[0].socket && ( !peers[0].socket->isOk() || peers[0].connectionMonitor->hasTimedOut() ) ) 324 320 { 321 this->handleDisconnect( 0); 325 322 PRINTF(1)("lost connection to server\n"); 326 327 peers[0].socket->disconnectServer();328 delete peers[0].socket;329 peers[0].socket = NULL;330 331 if ( peers[0].handshake )332 delete peers[0].handshake;333 peers[0].handshake = NULL;334 335 if ( peers[0].connectionMonitor )336 delete peers[0].connectionMonitor;337 peers[0].connectionMonitor = NULL;338 323 } 339 324 } … … 404 389 405 390 // check if the connecting client should reconnect to a proxy server 406 peers[clientId].handshake->setRedirect(/*this->networkMonitor->isReconnectNextClient()*/ false);391 peers[clientId].handshake->setRedirect(/*this->networkMonitor->isReconnectNextClient()*/true); 407 392 408 393 // the connecting node of course is a client … … 446 431 PRINTF(0)("Client is gone: %d (%s)\n", it->second.userId, reason.c_str()); 447 432 448 449 // clean up the network data 450 it->second.socket->disconnectServer(); 451 delete it->second.socket; 452 it->second.socket = NULL; 453 454 // remove the old connectin monitor 455 if ( it->second.connectionMonitor ) 456 delete it->second.connectionMonitor; 457 it->second.connectionMonitor = NULL; 458 459 // remove the handshake 460 if ( it->second.handshake ) 461 delete it->second.handshake; 462 it->second.handshake = NULL; 463 433 this->handleDisconnect( it->second.userId); 434 435 #warning this is some more disconnct handling, consider doing it in the handleDisconnect() funciton 464 436 // and cleanup the user infos 465 437 for ( SynchronizeableList::iterator it2 = synchronizeables.begin(); it2 != synchronizeables.end(); it2++ ) … … 563 535 this->handleReconnect( it->second.userId); 564 536 537 PRINTF(0)("redirection: %i\n\n\n", it->second.handshake->redirect()); 538 565 539 // create the new network game manager and init it 566 540 this->networkGameManager = NetworkGameManager::getInstance(); … … 659 633 660 634 /** 635 * handles the disconnect event 636 * @param userId id of the user to remove 637 */ 638 void NetworkStream::handleDisconnect( int userId ) 639 { 640 peers[userId].socket->disconnectServer(); 641 delete peers[userId].socket; 642 peers[userId].socket = NULL; 643 644 if ( peers[userId].handshake ) 645 delete peers[userId].handshake; 646 peers[userId].handshake = NULL; 647 648 if ( peers[userId].connectionMonitor ) 649 delete peers[userId].connectionMonitor; 650 peers[userId].connectionMonitor = NULL; 651 } 652 653 654 655 /** 661 656 * handle upstream network traffic 657 * @param tick: seconds elapsed since last update 662 658 */ 663 659 void NetworkStream::handleUpstream( int tick ) -
branches/proxy/src/lib/network/network_stream.h
r9406 r9419 80 80 81 81 void updateConnectionList(); 82 82 83 /* handle processes */ 83 84 void handleHandshakes(); … … 88 89 void handleNewClient( int userId ); 89 90 void handleReconnect( int userId ); 91 void handleDisconnect( int userId ); 90 92 91 93 void writeToNewDict( byte * data, int length, bool upstream );
Note: See TracChangeset
for help on using the changeset viewer.