[Orxonox-commit 3727] r8407 - code/trunk/src/libraries/network

scheusso at orxonox.net scheusso at orxonox.net
Thu May 5 23:14:59 CEST 2011


Author: scheusso
Date: 2011-05-05 23:14:59 +0200 (Thu, 05 May 2011)
New Revision: 8407

Modified:
   code/trunk/src/libraries/network/GamestateManager.cc
Log:
fixing a (quite huge) network memory leak


Modified: code/trunk/src/libraries/network/GamestateManager.cc
===================================================================
--- code/trunk/src/libraries/network/GamestateManager.cc	2011-05-05 19:11:46 UTC (rev 8406)
+++ code/trunk/src/libraries/network/GamestateManager.cc	2011-05-05 21:14:59 UTC (rev 8407)
@@ -227,7 +227,7 @@
 //     packet::Gamestate *gs = gamestate->doSelection(clientID, 20000);
 //       packet::Gamestate* gs = new packet::Gamestate(*gamestate);
 //     packet::Gamestate* gs = gamestate;
-    packet::Gamestate *gs = new packet::Gamestate(*gamestate); //TODO: is this neccessary ?
+    packet::Gamestate *gs = new packet::Gamestate(*gamestate); //this is neccessary because the gamestate are being kept (to diff them later on) for each client seperately
 //     packet::Gamestate *gs = new packet::Gamestate();
 //     gs->collectData( id_, 0x1 );
 //     this->threadMutex_->lock();
@@ -288,7 +288,7 @@
 //     }
 
 //    assert(curid==GAMESTATEID_INITIAL || curid<=gamestateID); // this line is commented out because acknowledgements are unreliable and may arrive in distorted order
-    if( gamestateID <= curid )
+    if( gamestateID <= curid && curid != GAMESTATEID_INITIAL )
         return true;
 COUT(4) << "acking gamestate " << gamestateID << " for peerID: " << peerID << " curid: " << curid << std::endl;
     std::map<uint32_t, packet::Gamestate*>::iterator it2;




More information about the Orxonox-commit mailing list