[Orxonox-commit 676] r3208 - in branches/netp5/src/network: . packet

scheusso at orxonox.net scheusso at orxonox.net
Tue Jun 23 00:51:43 CEST 2009


Author: scheusso
Date: 2009-06-23 00:51:43 +0200 (Tue, 23 Jun 2009)
New Revision: 3208

Modified:
   branches/netp5/src/network/NetworkFunction.h
   branches/netp5/src/network/packet/DeleteObjects.cc
   branches/netp5/src/network/packet/FunctionCalls.cc
   branches/netp5/src/network/packet/Packet.cc
Log:
some cleaning up
i hope that i found some memory leaks


Modified: branches/netp5/src/network/NetworkFunction.h
===================================================================
--- branches/netp5/src/network/NetworkFunction.h	2009-06-22 21:34:57 UTC (rev 3207)
+++ branches/netp5/src/network/NetworkFunction.h	2009-06-22 22:51:43 UTC (rev 3208)
@@ -74,7 +74,7 @@
     NetworkFunctionBase(std::string name);
     ~NetworkFunctionBase();
     
-    virtual void         setNetworkID(uint32_t id)       { this->networkID_ = id; }
+    virtual void        setNetworkID(uint32_t id)       { this->networkID_ = id; }
     inline uint32_t     getNetworkID() const            { return this->networkID_; }
     inline std::string  getName() const                 { return name_; }
     static inline bool  isStatic( uint32_t networkID )  { return isStaticMap_[networkID]; }

Modified: branches/netp5/src/network/packet/DeleteObjects.cc
===================================================================
--- branches/netp5/src/network/packet/DeleteObjects.cc	2009-06-22 21:34:57 UTC (rev 3207)
+++ branches/netp5/src/network/packet/DeleteObjects.cc	2009-06-22 22:51:43 UTC (rev 3208)
@@ -89,6 +89,7 @@
     COUT(4) << "deleting object with id: " << *(uint32_t*)(data_+_OBJECTIDS+i*sizeof(uint32_t)) << std::endl;
     Synchronisable::deleteObject( *(uint32_t*)(data_+_OBJECTIDS+i*sizeof(uint32_t)) );
   }
+  delete this;
   return true;
 }
 

Modified: branches/netp5/src/network/packet/FunctionCalls.cc
===================================================================
--- branches/netp5/src/network/packet/FunctionCalls.cc	2009-06-22 21:34:57 UTC (rev 3207)
+++ branches/netp5/src/network/packet/FunctionCalls.cc	2009-06-22 22:51:43 UTC (rev 3208)
@@ -65,7 +65,6 @@
 
 
 bool FunctionCalls::process(){
-  printf("process function calls\n");
   assert(isDataENetAllocated());
   uint8_t* temp = data_+sizeof(uint32_t); //skip packetid
   this->nrOfCalls_ = *(uint32_t*)temp;

Modified: branches/netp5/src/network/packet/Packet.cc
===================================================================
--- branches/netp5/src/network/packet/Packet.cc	2009-06-22 21:34:57 UTC (rev 3207)
+++ branches/netp5/src/network/packet/Packet.cc	2009-06-22 22:51:43 UTC (rev 3208)
@@ -53,7 +53,6 @@
 #define _PACKETID           0
 
 std::map<size_t, Packet *> Packet::packetMap_;
-//! Static mutex for any packetMap_ access
 
 Packet::Packet(){
   flags_ = PACKET_FLAG_DEFAULT;
@@ -212,6 +211,7 @@
 
   // Data was created by ENet
   p->bDataENetAllocated_ = true;
+  p->enetPacket_ = packet;
 
   return p;
 }
@@ -229,7 +229,7 @@
   it->second->enetPacket_ = 0;
   delete it->second;
   packetMap_.erase(it);
-  COUT(4) << "PacketMap size: " << packetMap_.size() << std::endl;
+  COUT(6) << "PacketMap size: " << packetMap_.size() << std::endl;
 }
 
 } // namespace packet




More information about the Orxonox-commit mailing list