Changeset 9406 in orxonox.OLD for trunk/src/lib/network/network_stream.cc
- Timestamp:
- Jul 24, 2006, 11:09:47 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/network_stream.cc
r9246 r9406 12 12 main-programmer: Christoph Renner rennerc@ee.ethz.ch 13 13 co-programmer: Patrick Boenzli boenzlip@orxonox.ethz.ch 14 15 June 2006: finishing work on the network stream for pps presentation (rennerc@ee.ethz.ch) 16 July 2006: some code rearangement and integration of the proxy server mechanism (boenzlip@ee.ethz.ch) 14 17 */ 15 18 … … 22 25 #include "udp_socket.h" 23 26 #include "udp_server_socket.h" 24 #include "connection_monitor.h" 27 #include "monitor/connection_monitor.h" 28 #include "monitor/network_monitor.h" 25 29 #include "synchronizeable.h" 30 #include "ip.h" 26 31 #include "network_game_manager.h" 27 32 #include "shared_network_data.h" … … 42 47 #include <algorithm> 43 48 44 /* include your own header */ 49 45 50 #include "network_stream.h" 46 51 47 /* probably unnecessary */ 48 using namespace std; 52 53 #include "converter.h" 49 54 50 55 … … 52 57 53 58 59 /** 60 * empty constructor 61 */ 54 62 NetworkStream::NetworkStream() 55 63 : DataStream() … … 57 65 this->init(); 58 66 /* initialize the references */ 59 this->type = NET_CLIENT; 60 } 61 62 63 /** 64 * connect to a server as a client 65 * @param host: host name (address) 66 * @param port: port number 67 */ 68 NetworkStream::NetworkStream( std::string host, int port ) 69 { 70 this->type = NET_CLIENT; 67 this->pInfo->nodeType = NET_CLIENT; 68 } 69 70 71 NetworkStream::NetworkStream( int nodeType) 72 { 71 73 this->init(); 72 this->peers[0].socket = new UdpSocket( host, port ); 73 this->peers[0].userId = 0; 74 this->peers[0].isServer = true; 75 this->peers[0].connectionMonitor = new ConnectionMonitor( 0 ); 76 } 77 78 79 /** 80 * start as a server 81 * @param port: at this port 82 */ 83 NetworkStream::NetworkStream( int port ) 84 { 85 this->type = NET_SERVER; 86 this->init(); 87 this->serverSocket = new UdpServerSocket(port); 88 this->bActive = true; 89 } 74 75 this->pInfo->nodeType = nodeType; 76 77 switch( nodeType) 78 { 79 case NET_MASTER_SERVER: 80 // init the shared network data 81 SharedNetworkData::getInstance()->setHostID(0); 82 // SharedNetworkData::getInstance()->setNodeType(NET_MASTER_SERVER); 83 break; 84 85 case NET_PROXY_SERVER_ACTIVE: 86 // init the shared network data 87 SharedNetworkData::getInstance()->setHostID(0); 88 // SharedNetworkData::getInstance()->setNodeType(NET_PROXY_SERVER_ACTIVE); 89 break; 90 case NET_PROXY_SERVER_PASSIVE: 91 // init the shared network data 92 SharedNetworkData::getInstance()->setHostID(0); 93 // SharedNetworkData::getInstance()->setNodeType(NET_PROXY_SERVER_PASSIVE); 94 break; 95 case NET_CLIENT: 96 // SharedNetworkData::getInstance()->setNodeType(NET_CLIENT); 97 break; 98 } 99 100 SharedNetworkData::getInstance()->setDefaultSyncStream(this); 101 102 // get the local ip address 103 IPaddress ip; 104 SDLNet_ResolveHost( &ip, NULL, 0); 105 this->pInfo->ip = ip; 106 } 107 90 108 91 109 … … 97 115 /* set the class id for the base object */ 98 116 this->setClassID(CL_NETWORK_STREAM, "NetworkStream"); 99 this->bActive = false;100 117 this->serverSocket = NULL; 101 118 this->networkGameManager = NULL; 102 myHostId = 0; 103 currentState = 0; 119 this->networkMonitor = NULL; 120 121 this->pInfo = new PeerInfo(); 122 this->pInfo->userId = 0; 123 this->pInfo->lastAckedState = 0; 124 this->pInfo->lastRecvedState = 0; 125 126 127 this->currentState = 0; 104 128 105 129 remainingBytesToWriteToDict = Preferences::getInstance()->getInt( "compression", "writedict", 0 ); … … 147 171 for ( SynchronizeableList::const_iterator it = getSyncBegin(); it != getSyncEnd(); it ++ ) 148 172 (*it)->setNetworkStream( NULL ); 173 174 if( this->pInfo) 175 delete this->pInfo; 176 177 if( this->networkMonitor) 178 delete this->networkMonitor; 179 } 180 181 182 /** 183 * establish a connection to a remote master server 184 * @param host: host name 185 * @param port: the port number 186 */ 187 void NetworkStream::connectToMasterServer(std::string host, int port) 188 { 189 int node = this->peers.size(); 190 this->peers[node].socket = new UdpSocket( host, port ); 191 this->peers[node].userId = 0; 192 193 this->peers[node].nodeType = NET_MASTER_SERVER; 194 this->peers[node].connectionMonitor = new ConnectionMonitor( 0 ); 195 this->peers[node].ip = this->peers[node].socket->getRemoteAddress(); 196 } 197 198 199 /** 200 * establish a connection to a remote proxy server 201 * @param host: host name 202 * @param port: the port number 203 */ 204 void NetworkStream::connectToProxyServer(std::string host, int port) 205 { 206 int node = this->peers.size(); 207 this->peers[node].socket = new UdpSocket( host, port ); 208 this->peers[node].userId = 0; 209 210 this->peers[node].nodeType = NET_PROXY_SERVER_ACTIVE; 211 this->peers[node].connectionMonitor = new ConnectionMonitor( 0 ); 212 this->peers[node].ip = this->peers[node].socket->getRemoteAddress(); 213 } 214 215 216 /** 217 * create a server 218 * @param port: interface port for all clients 219 */ 220 void NetworkStream::createServer(int port) 221 { 222 this->serverSocket = new UdpServerSocket(port); 149 223 } 150 224 … … 156 230 { 157 231 this->networkGameManager = NetworkGameManager::getInstance(); 158 // setUniqueID( maxCon+2 ) because we need one id for every handshake 159 // and one for handshake to reject client maxCon+1 232 160 233 this->networkGameManager->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() ); 161 234 MessageManager::getInstance()->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() ); … … 165 238 /** 166 239 * starts the network handshake 240 * handsakes are always initialized from the client side first. this starts the handshake and therefore is only 241 * executed as client 167 242 */ 168 243 void NetworkStream::startHandshake() 169 244 { 170 Handshake* hs = new Handshake( false);245 Handshake* hs = new Handshake(this->pInfo->nodeType); 171 246 hs->setUniqueID( 0 ); 172 247 assert( peers[0].handshake == NULL ); 173 248 peers[0].handshake = hs; 174 249 250 // set the preferred nick name 175 251 hs->setPreferedNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Player" ) ); 176 252 177 // peers[0].handshake->setSynchronized( true ); 178 //this->connectSynchronizeable(*hs); 179 //this->connectSynchronizeable(*hs); 180 PRINTF(0)("NetworkStream: Handshake created: %s\n", hs->getName()); 253 PRINTF(0)("NetworkStream: Handshake created: %s\n", hs->getCName()); 181 254 } 182 255 … … 192 265 sync.setNetworkStream( this ); 193 266 194 this->bActive = true;267 // this->bActive = true; 195 268 } 196 269 … … 215 288 void NetworkStream::processData() 216 289 { 290 // create the network monitor after all the init work and before there is any connection handlings 291 if( this->networkMonitor == NULL) 292 this->networkMonitor = new NetworkMonitor(this); 293 294 217 295 int tick = SDL_GetTicks(); 218 296 219 currentState++; 220 221 if ( this->type == NET_SERVER ) 222 { 297 this->currentState++; 298 // there was a wrap around 299 if( this->currentState < 0) 300 { 301 PRINTF(1)("A wrap around in the state variable as occured. The server was running so long? Pls restart server or write a mail to the supporters!\n"); 302 } 303 304 if ( this->pInfo->isMasterServer()) 305 { 306 // execute everytthing the master server shoudl do 307 if ( serverSocket ) 308 serverSocket->update(); 309 310 this->updateConnectionList(); 311 } 312 else if( this->pInfo->isProxyServer()) 313 { 314 // execute everything the proxy server should do 223 315 if ( serverSocket ) 224 316 serverSocket->update(); … … 249 341 cleanUpOldSyncList(); 250 342 handleHandshakes(); 343 344 // update the network monitor 345 this->networkMonitor->process(); 251 346 252 347 // order of up/downstream is important!!!! … … 258 353 259 354 /** 260 * if we are a server update the connection list to accept new connections (clients)261 * also start the handsake for the new clients355 * if we are a NET_MASTER_SERVER or NET_PROXY_SERVER_ACTIVE update the connection list to accept new 356 * connections (clients) also start the handsake for the new clients 262 357 */ 263 358 void NetworkStream::updateConnectionList( ) … … 276 371 clientId = freeSocketSlots.back(); 277 372 freeSocketSlots.pop_back(); 278 peers[clientId].socket = tempNetworkSocket;279 peers[clientId].handshake = new Handshake(true, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID() );280 peers[clientId].connectionMonitor = new ConnectionMonitor( clientId );281 peers[clientId].handshake->setUniqueID(clientId);282 peers[clientId].userId = clientId;283 peers[clientId].isServer = false;284 373 } 285 374 else … … 290 379 if ( it->first >= clientId ) 291 380 clientId = it->first + 1; 292 293 peers[clientId].socket = tempNetworkSocket; 294 peers[clientId].handshake = new Handshake(true, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID()); 295 peers[clientId].handshake->setUniqueID(clientId); 296 peers[clientId].connectionMonitor = new ConnectionMonitor( clientId ); 297 peers[clientId].userId = clientId; 298 peers[clientId].isServer = false; 299 300 PRINTF(0)("num sync: %d\n", synchronizeables.size()); 301 } 302 303 // check if there are too many clients connected 304 if ( clientId > MAX_CONNECTIONS ) 305 { 306 peers[clientId].handshake->doReject( "too many connections" ); 307 PRINTF(0)("Will reject client %d because there are to many connections!\n", clientId); 308 } 309 else 310 { 311 PRINTF(0)("New Client: %d\n", clientId); 312 } 313 314 //this->connectSynchronizeable(*handshakes[clientId]); 381 } 382 peers[clientId].socket = tempNetworkSocket; 383 384 385 // create new handshake and init its variables 386 peers[clientId].handshake = new Handshake(this->pInfo->nodeType, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID()); 387 peers[clientId].handshake->setUniqueID(clientId); 388 389 peers[clientId].connectionMonitor = new ConnectionMonitor( clientId ); 390 peers[clientId].userId = clientId; 391 392 PRINTF(0)("num sync: %d\n", synchronizeables.size()); 393 394 // get the proxy server informations and write them to the handshake, if any (proxy) 395 assert( this->networkMonitor != NULL); 396 PeerInfo* pi = this->networkMonitor->getFirstChoiceProxy(); 397 if( pi != NULL) 398 { 399 peers[clientId].handshake->setProxy1Address( pi->ip); 400 } 401 pi = this->networkMonitor->getSecondChoiceProxy(); 402 if( pi != NULL) 403 peers[clientId].handshake->setProxy2Address( pi->ip); 404 405 // check if the connecting client should reconnect to a proxy server 406 peers[clientId].handshake->setRedirect(/*this->networkMonitor->isReconnectNextClient()*/false); 407 408 // the connecting node of course is a client 409 peers[clientId].nodeType = NET_CLIENT; 410 peers[clientId].ip = peers[clientId].socket->getRemoteAddress(); 411 412 413 // check if there are too many clients connected (DEPRECATED: new: the masterserver sends a list of proxy servers) 414 // if ( clientId > SharedNetworkData::getInstance()->getMaxPlayer() ) 415 // { 416 // // peers[clientId].handshake->setRedirect(true); 417 // // 418 // // peers[clientId].handshake->doReject( "too many connections" ); 419 // PRINTF(0)("Will reject client %d because there are to many connections!\n", clientId); 420 // } 421 // else 422 // { 423 // PRINTF(0)("New Client: %d\n", clientId); 424 // } 425 PRINTF(0)("New Client: %d\n", clientId); 426 427 315 428 } 316 429 … … 339 452 it->second.socket = NULL; 340 453 454 // remove the old connectin monitor 341 455 if ( it->second.connectionMonitor ) 342 456 delete it->second.connectionMonitor; 343 457 it->second.connectionMonitor = NULL; 344 458 459 // remove the handshake 345 460 if ( it->second.handshake ) 346 461 delete it->second.handshake; 347 462 it->second.handshake = NULL; 348 463 464 // and cleanup the user infos 349 465 for ( SynchronizeableList::iterator it2 = synchronizeables.begin(); it2 != synchronizeables.end(); it2++ ) 350 466 { … … 373 489 void NetworkStream::debug() 374 490 { 375 if( this->isServer()) 376 PRINT(0)(" Host ist Server with ID: %i\n", this->myHostId); 377 else 378 PRINT(0)(" Host ist Client with ID: %i\n", this->myHostId); 491 if( SharedNetworkData::getInstance()->isMasterServer()) { 492 PRINT(0)(" Host ist Master Server with ID: %i\n", this->pInfo->userId); 493 } 494 else if( SharedNetworkData::getInstance()->isProxyServer()) { 495 PRINT(0)(" Host ist Proxy Server with ID: %i\n", this->pInfo->userId); 496 } 497 else { 498 PRINT(0)(" Host ist Client with ID: %i\n", this->pInfo->userId); 499 } 379 500 380 501 PRINT(0)(" Got %i connected Synchronizeables, showing active Syncs:\n", this->synchronizeables.size()); … … 382 503 { 383 504 if( (*it)->beSynchronized() == true) 384 PRINT(0)(" Synchronizeable of class: %s::%s, with unique ID: %i, Synchronize: %i\n", (*it)->getClass Name(), (*it)->getName(),505 PRINT(0)(" Synchronizeable of class: %s::%s, with unique ID: %i, Synchronize: %i\n", (*it)->getClassCName(), (*it)->getCName(), 385 506 (*it)->getUniqueID(), (*it)->beSynchronized()); 386 507 } 387 PRINT(0)(" Maximal Connections: %i\n", MAX_CONNECTIONS);508 PRINT(0)(" Maximal Connections: %i\n", SharedNetworkData::getInstance()->getMaxPlayer() ); 388 509 389 510 } … … 414 535 if ( it->second.handshake ) 415 536 { 537 // handshake finished 416 538 if ( it->second.handshake->completed() ) 417 539 { 540 //handshake is correct 418 541 if ( it->second.handshake->ok() ) 419 542 { 543 // the server gave it free for deletion 420 544 if ( !it->second.handshake->allowDel() ) 421 545 { 422 if ( type != NET_SERVER ) 546 547 if ( this->pInfo->isClient() ) 423 548 { 424 549 SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() ); 425 myHostId = SharedNetworkData::getInstance()->getHostID(); 426 550 this->pInfo->userId = SharedNetworkData::getInstance()->getHostID(); 551 552 it->second.nodeType = it->second.handshake->getRemoteNodeType(); 553 it->second.ip = it->second.socket->getRemoteAddress(); 554 // add the new server to the nodes list (it can be a NET_MASTER_SERVER or NET_PROXY_SERVER) 555 this->networkMonitor->addNode(&it->second); 556 // get proxy 1 address and add it 557 this->networkMonitor->addNode(it->second.handshake->getProxy1Address(), NET_PROXY_SERVER_ACTIVE); 558 // get proxy 2 address and add it 559 this->networkMonitor->addNode(it->second.handshake->getProxy2Address(), NET_PROXY_SERVER_ACTIVE); 560 561 // now check if the server accepted the connection 562 if( it->second.handshake->redirect()) 563 this->handleReconnect( it->second.userId); 564 565 // create the new network game manager and init it 427 566 this->networkGameManager = NetworkGameManager::getInstance(); 428 567 this->networkGameManager->setUniqueID( it->second.handshake->getNetworkGameManagerId() ); 568 // init the new message manager 429 569 MessageManager::getInstance()->setUniqueID( it->second.handshake->getMessageManagerId() ); 430 570 } … … 432 572 433 573 PRINT(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId()); 434 435 574 it->second.handshake->del(); 436 575 } 437 576 else 438 577 { 578 // handshake finished registring new player 439 579 if ( it->second.handshake->canDel() ) 440 580 { 441 if ( type == NET_SERVER ) 581 582 if ( this->pInfo->isMasterServer() ) 442 583 { 443 handleNewClient( it->second.userId ); 584 it->second.nodeType = it->second.handshake->getRemoteNodeType(); 585 it->second.ip = it->second.socket->getRemoteAddress(); 586 587 this->networkMonitor->addNode(&it->second); 588 589 this->handleNewClient( it->second.userId ); 590 591 if ( PlayerStats::getStats( it->second.userId ) && it->second.handshake->getPreferedNickName() != "" ) 592 { 593 PlayerStats::getStats( it->second.userId )->setNickName( it->second.handshake->getPreferedNickName() ); 594 } 595 } 596 else if ( this->pInfo->isProxyServer() ) 597 { 598 it->second.nodeType = it->second.handshake->getRemoteNodeType(); 599 it->second.ip = it->second.socket->getRemoteAddress(); 600 601 this->networkMonitor->addNode(&it->second); 602 603 this->handleNewClient( it->second.userId ); 444 604 445 605 if ( PlayerStats::getStats( it->second.userId ) && it->second.handshake->getPreferedNickName() != "" ) … … 468 628 469 629 /** 630 * this functions handles a reconnect event received from the a NET_MASTER_SERVER or NET_PROXY_SERVER 631 */ 632 void NetworkStream::handleReconnect(int userId) 633 { 634 PRINTF(0)("===============================================\n"); 635 PRINTF(0)("Client is redirected to the other proxy servers\n"); 636 PRINTF(0)("===============================================\n"); 637 638 return; 639 640 PeerInfo* pInfo = &this->peers[userId]; 641 642 // reject the server 643 pInfo->handshake->doReject( "redirected to different server"); 644 645 // flush the old synchronization states, since the numbering could be completely different 646 pInfo->lastAckedState = 0; 647 pInfo->lastRecvedState = 0; 648 // not sure if this works as expected 649 if( pInfo->handshake) 650 delete pInfo->handshake; 651 652 // disconnect from the current server and reconnect to proxy server 653 pInfo->socket->reconnectToServer( pInfo->handshake->getProxy1Address().ipString(), pInfo->handshake->getProxy1Address().port()); 654 655 // and restart the handshake 656 this->startHandshake(); 657 } 658 659 660 /** 470 661 * handle upstream network traffic 471 662 */ … … 501 692 for ( SynchronizeableList::iterator it = synchronizeables.begin(); it != synchronizeables.end(); it++ ) 502 693 { 694 503 695 int oldOffset = offset; 504 696 Synchronizeable & sync = **it; 697 505 698 506 699 // do not include synchronizeables with uninit id and syncs that don't want to be synchronized … … 512 705 continue; 513 706 514 // if we are a server and this is not our handshake515 if ( isServer() && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )707 // if we are a server (both master and proxy servers) and this is not our handshake 708 if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId ) 516 709 continue; 517 710 … … 521 714 continue; 522 715 716 717 assert( sync.getLeafClassID() != 0); 718 523 719 assert( offset + INTSIZE <= UDP_PACKET_SIZE ); 524 720 525 721 // server fakes uniqueid == 0 for handshake 526 if ( this->isServer() && sync.getUniqueID() < MAX_CONNECTIONS - 1 ) 722 if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() ) && 723 sync.getUniqueID() <= SharedNetworkData::getInstance()->getMaxPlayer() + 1) // plus one to handle one client more than the max to redirect it 527 724 n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset ); 528 725 else 529 726 n = Converter::intToByteArray( sync.getUniqueID(), buf + offset, UDP_PACKET_SIZE - offset ); 530 727 728 531 729 assert( n == INTSIZE ); 532 730 offset += n; 533 731 534 // make space for size732 // make space for packet size 535 733 offset += INTSIZE; 536 734 … … 573 771 // now compress the data with the zip library 574 772 int compLength = 0; 575 if ( this->isServer())773 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) 576 774 compLength = Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictServer ); 577 775 else … … 637 835 assert( Converter::byteArrayToInt( buf + 2*INTSIZE, &fromState ) == INTSIZE ); 638 836 assert( Converter::byteArrayToInt( buf + 3*INTSIZE, &ackedState ) == INTSIZE ); 639 //NETPRINTF(n)("ackedstate: %d\n", ackedState);640 837 offset = 4*INTSIZE; 641 838 642 839 peer->second.connectionMonitor->processUnzippedIncomingPacket( tick, buf, packetLength, state, ackedState ); 643 840 644 //NETPRINTF(n)("got packet: %d, %d\n", length, packetLength); 645 646 //if this is an old state drop it 841 842 //if this is an old state drop it 647 843 if ( state <= peer->second.lastRecvedState ) 648 844 continue; … … 655 851 } 656 852 657 while ( offset + 2 *INTSIZE < length )853 while ( offset + 2 * INTSIZE < length ) 658 854 { 659 855 assert( offset > 0 ); … … 669 865 Synchronizeable * sync = NULL; 670 866 867 // look for the synchronizeable in question 671 868 for ( SynchronizeableList::iterator it = synchronizeables.begin(); it != synchronizeables.end(); it++ ) 672 869 { 673 //client thinks his handshake has id 0!!!!!870 // client thinks his handshake has id 0!!!!! 674 871 if ( (*it)->getUniqueID() == uniqueId || ( uniqueId == 0 && (*it)->getUniqueID() == peer->second.userId ) ) 675 872 { … … 679 876 } 680 877 878 // this synchronizeable does not yet exist! create it 681 879 if ( sync == NULL ) 682 880 { 683 881 PRINTF(0)("could not find sync with id %d. try to create it\n", uniqueId); 882 883 // if it is an old synchronizeable already removed, ignore it 684 884 if ( oldSynchronizeables.find( uniqueId ) != oldSynchronizeables.end() ) 685 885 { … … 688 888 } 689 889 690 if ( !peers[peer->second.userId].isServer ) 890 // if the node we got this unknown sync from is a client we ignore it (since it has no rights to create a new sync) 891 if ( peers[peer->second.userId].isClient() ) 691 892 { 692 893 offset += syncDataLength; … … 705 906 assert( leafClassId != 0 ); 706 907 908 707 909 BaseObject * b = NULL; 708 910 /* These are some small exeptions in creation: Not all objects can/should be created via Factory */ … … 710 912 if( leafClassId == CL_NULL_PARENT || leafClassId == CL_SYNCHRONIZEABLE || leafClassId == CL_NETWORK_GAME_MANAGER ) 711 913 { 712 PRINTF(1)(" Can not create Class with ID %x!\n", (int)leafClassId);914 PRINTF(1)("Don't create Object with ID %x, ignored!\n", (int)leafClassId); 713 915 offset += syncDataLength; 714 916 continue; … … 730 932 sync->setSynchronized(true); 731 933 732 PRINTF(0)("Fabricated %s with id %d\n", sync->getClass Name(), sync->getUniqueID());934 PRINTF(0)("Fabricated %s with id %d\n", sync->getClassCName(), sync->getUniqueID()); 733 935 } 734 936 else … … 744 946 int n = sync->setStateDiff( peer->second.userId, buf+offset, syncDataLength, state, fromState ); 745 947 offset += n; 746 //NETPRINTF(0)("SSSSSEEEEETTTTT: %s %d\n",sync->getClassName(), n);747 948 748 949 } … … 779 980 /** 780 981 * is executed when a handshake has finished 781 * @todo create playable for new user782 982 */ 783 983 void NetworkStream::handleNewClient( int userId ) 784 984 { 985 // init and assign the message manager 785 986 MessageManager::getInstance()->initUser( userId ); 786 987 // do all game relevant stuff here 787 988 networkGameManager->signalNewPlayer( userId ); 788 989 } 990 789 991 790 992 /**
Note: See TracChangeset
for help on using the changeset viewer.