[Orxonox-commit 3205] r7898 - in code/branches/network6/src/libraries/network: . packet

scheusso at orxonox.net scheusso at orxonox.net
Tue Feb 15 11:37:15 CET 2011


Author: scheusso
Date: 2011-02-15 11:37:15 +0100 (Tue, 15 Feb 2011)
New Revision: 7898

Modified:
   code/branches/network6/src/libraries/network/Connection.cc
   code/branches/network6/src/libraries/network/ServerConnection.cc
   code/branches/network6/src/libraries/network/packet/Gamestate.cc
Log:
trying to fix some uninitialised value warnings from valgrind
remove overall mutex


Modified: code/branches/network6/src/libraries/network/Connection.cc
===================================================================
--- code/branches/network6/src/libraries/network/Connection.cc	2011-02-14 23:15:43 UTC (rev 7897)
+++ code/branches/network6/src/libraries/network/Connection.cc	2011-02-15 10:37:15 UTC (rev 7898)
@@ -41,7 +41,7 @@
 
 namespace orxonox
 {
-  const boost::posix_time::millisec NETWORK_COMMUNICATION_THREAD_WAIT_TIME(20);
+  const boost::posix_time::millisec NETWORK_COMMUNICATION_THREAD_WAIT_TIME(200);
   const unsigned int                NETWORK_DISCONNECT_TIMEOUT = 500;
 
   Connection::Connection(uint32_t firstPeerID):
@@ -51,7 +51,7 @@
     atexit(enet_deinitialize);
     this->incomingEventsMutex_ = new boost::mutex;
     this->outgoingEventsMutex_ = new boost::mutex;
-    this->overallMutex_ = new boost::mutex;
+//     this->overallMutex_ = new boost::mutex;
   }
 
   Connection::~Connection()
@@ -79,13 +79,13 @@
 
   void Connection::disconnectPeer(uint32_t peerID)
   {
-    this->overallMutex_->lock();
+//     this->overallMutex_->lock();
     outgoingEvent outEvent = { peerID, outgoingEventType::disconnectPeer, 0, 0 };
     
     this->outgoingEventsMutex_->lock();
     this->outgoingEvents_.push_back(outEvent);
     this->outgoingEventsMutex_->unlock();
-    this->overallMutex_->unlock();
+//     this->overallMutex_->unlock();
   }
   
   void Connection::disconnectPeers()
@@ -99,24 +99,24 @@
 
   void Connection::addPacket(ENetPacket* packet, uint32_t peerID, uint8_t channelID)
   {
-    this->overallMutex_->lock();
+//     this->overallMutex_->lock();
     outgoingEvent outEvent = { peerID, outgoingEventType::sendPacket, packet, channelID };
     
     this->outgoingEventsMutex_->lock();
     this->outgoingEvents_.push_back(outEvent);
     this->outgoingEventsMutex_->unlock();
-    this->overallMutex_->unlock();
+//     this->overallMutex_->unlock();
   }
   
   void Connection::broadcastPacket(ENetPacket* packet, uint8_t channelID)
   {
-    this->overallMutex_->lock();
+//     this->overallMutex_->lock();
     outgoingEvent outEvent = { 0, outgoingEventType::broadcastPacket, packet, channelID };
     
     this->outgoingEventsMutex_->lock();
     this->outgoingEvents_.push_back(outEvent);
     this->outgoingEventsMutex_->unlock();
-    this->overallMutex_->unlock();
+//     this->overallMutex_->unlock();
   }
 
   
@@ -124,7 +124,7 @@
   {
     ENetEvent event;
     
-    this->overallMutex_->lock();
+//     this->overallMutex_->lock();
     while( bCommunicationThreadRunning_ )
     {
       // Receive all pending incoming Events (such as packets, connects and disconnects)
@@ -133,9 +133,9 @@
         processIncomingEvent(event);
       }
       
-      this->overallMutex_->unlock();
+//       this->overallMutex_->unlock();
       msleep(10);
-      this->overallMutex_->lock();
+//       this->overallMutex_->lock();
       
       // Send all waiting outgoing packets
       this->outgoingEventsMutex_->lock();
@@ -162,7 +162,7 @@
         processIncomingEvent(event);
       }
     }
-    this->overallMutex_->unlock();
+//     this->overallMutex_->unlock();
   }
   
   void Connection::processIncomingEvent(ENetEvent& event)

Modified: code/branches/network6/src/libraries/network/ServerConnection.cc
===================================================================
--- code/branches/network6/src/libraries/network/ServerConnection.cc	2011-02-14 23:15:43 UTC (rev 7897)
+++ code/branches/network6/src/libraries/network/ServerConnection.cc	2011-02-15 10:37:15 UTC (rev 7898)
@@ -44,9 +44,10 @@
     bListening_(false)
   {
     this->bindAddress_ = new ENetAddress();
-    memset(this->bindAddress_, 0, sizeof(ENetAddress));
+//     memset(this->bindAddress_, 0, sizeof(ENetAddress));
     this->bindAddress_->host = ENET_HOST_ANY;
     this->bindAddress_->port = NETWORK_PORT;
+    this->bindAddress_->scopeID = 0;
   }
 
   ServerConnection::~ServerConnection()

Modified: code/branches/network6/src/libraries/network/packet/Gamestate.cc
===================================================================
--- code/branches/network6/src/libraries/network/packet/Gamestate.cc	2011-02-14 23:15:43 UTC (rev 7897)
+++ code/branches/network6/src/libraries/network/packet/Gamestate.cc	2011-02-15 10:37:15 UTC (rev 7898)
@@ -157,6 +157,7 @@
 
   //start write gamestate header
   header_.setDataSize( currentsize );
+  header_.setCompSize( 0 );
   header_.setID( id );
   header_.setBaseID( GAMESTATEID_INITIAL );
   header_.setDiffed( false );




More information about the Orxonox-commit mailing list