Changeset 9604 in orxonox.OLD for branches/proxy/src/lib
- Timestamp:
- Jul 29, 2006, 11:22:58 AM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/network_manager.cc
r9600 r9604 112 112 // create the network stream 113 113 this->networkStream = new NetworkStream(NET_MASTER_SERVER); 114 this->networkStream->createServer( port, port + 1 );114 this->networkStream->createServer( port, port + 1, port + 2); 115 115 116 116 // start the network game manager … … 142 142 143 143 // then start the server 144 this->networkStream->createServer( port, port + 1);144 this->networkStream->createServer( port, port + 1, port + 2); 145 145 146 146 // and to the other proxy servers also, this would be very nice if its works -
branches/proxy/src/lib/network/network_stream.cc
r9601 r9604 113 113 this->setClassID(CL_NETWORK_STREAM, "NetworkStream"); 114 114 this->clientSocket = NULL; 115 this->clientSoftSocket = NULL; 115 116 this->proxySocket = NULL; 116 117 this->networkGameManager = NULL; … … 144 145 if ( this->clientSocket ) 145 146 { 146 clientSocket->close(); 147 delete clientSocket; 148 clientSocket = NULL; 147 this->clientSocket->close(); 148 delete this->clientSocket; 149 this->clientSocket = NULL; 150 } 151 if ( this->clientSoftSocket ) 152 { 153 this->clientSoftSocket->close(); 154 delete this->clientSoftSocket; 155 this->clientSoftSocket = NULL; 149 156 } 150 157 if ( this->proxySocket) … … 229 236 * @param port: interface port for all clients 230 237 */ 231 void NetworkStream::createServer(int clientPort, int proxyPort )238 void NetworkStream::createServer(int clientPort, int proxyPort, int clientSoftPort) 232 239 { 233 240 PRINTF(0)(" Creating new Server: listening for clients on port %i and for proxies on port %i", clientPort, proxyPort); 234 241 this->clientSocket= new UdpServerSocket(clientPort); 242 this->clientSoftSocket= new UdpServerSocket(clientSoftPort); 235 243 this->proxySocket = new UdpServerSocket(proxyPort); 236 244 } … … 326 334 if ( this->clientSocket ) 327 335 this->clientSocket->update(); 336 if ( this->clientSoftSocket) 337 this->clientSoftSocket->update(); 328 338 if( this->proxySocket) 329 339 this->proxySocket->update(); … … 336 346 if ( this->clientSocket ) 337 347 this->clientSocket->update(); 348 if ( this->clientSoftSocket) 349 this->clientSoftSocket->update(); 338 350 if( this->proxySocket) 339 351 this->proxySocket->update(); … … 424 436 } 425 437 438 if( this->clientSoftSocket != NULL) 439 { 440 tempNetworkSocket = this->clientSoftSocket->getNewSocket(); 441 442 // we got new NET_CLIENT connecting 443 if ( tempNetworkSocket ) 444 { 445 446 // this creates a new entry in the peers list 447 peers[userId].socket = tempNetworkSocket; 448 peers[userId].nodeType = NET_CLIENT; 449 450 // handle the newly connected client 451 this->handleSoftConnect(userId); 452 453 PRINTF(0)("New Client softly connected: %d :D\n", userId); 454 } 455 } 456 426 457 427 458 if( this->proxySocket != NULL) … … 540 571 this->peers[userId].ip = this->peers[userId].socket->getRemoteAddress(); 541 572 } 573 574 575 /** 576 * this handles new soft connections 577 * @param userId: the id of the new user node 578 * 579 * soft connections are connections from clients that are already in the network and don't need a new handshake etc. 580 * the state of all entitites owned by userId are not deleted and stay 581 * soft connections can not be redirected therefore they are negotiated between the to parties 582 */ 583 void NetworkStream::handleSoftConnect( int userId) 584 { 585 // create new handshake and init its variables 586 this->peers[userId].handshake = NULL; 587 this->peers[userId].handshake->setUniqueID(userId); 588 589 this->peers[userId].connectionMonitor = new ConnectionMonitor( userId ); 590 this->peers[userId].userId = userId; 591 this->peers[userId].bLocal = true; 592 593 PRINTF(0)("num sync: %d\n", synchronizeables.size()); 594 595 // the connecting node of course is a client 596 this->peers[userId].ip = this->peers[userId].socket->getRemoteAddress(); 597 } 598 542 599 543 600 -
branches/proxy/src/lib/network/network_stream.h
r9600 r9604 44 44 void connectToMasterServer(std::string host, int port); 45 45 void connectToProxyServer(int proxyId, std::string host, int port); 46 void createServer(int clientPort, int proxyPort );46 void createServer(int clientPort, int proxyPort, int clientSoftPort); 47 47 48 48 void createNetworkGameManager(); … … 101 101 102 102 void handleConnect( int userId); 103 void handleSoftConnect( int userId); 103 104 void handleReconnect( int userId ); 104 105 void handleDisconnect( int userId ); … … 117 118 NetworkMonitor* networkMonitor; //!< the network monitor 118 119 NetworkGameManager* networkGameManager; //!< reference to the network game manager 119 ServerSocket* clientSocket; //!< the listening socket of the server 120 ServerSocket* clientSocket; //!< the listening socket for clients of the server 121 ServerSocket* clientSoftSocket; //!< the listening socket for soft connections to the server 120 122 ServerSocket* proxySocket; //!< socket for proxy connections 121 123
Note: See TracChangeset
for help on using the changeset viewer.