Index: branches/network/src/lib/network/handshake.cc
===================================================================
--- branches/network/src/lib/network/handshake.cc	(revision 7590)
+++ branches/network/src/lib/network/handshake.cc	(revision 7591)
@@ -79,4 +79,6 @@
         return;
       }
+      else
+        localState.completed = true;
     }
      
@@ -90,4 +92,6 @@
         return;
       }
+      else
+        localState.completed = true;
     }
     
Index: branches/network/src/lib/network/handshake.h
===================================================================
--- branches/network/src/lib/network/handshake.h	(revision 7590)
+++ branches/network/src/lib/network/handshake.h	(revision 7591)
@@ -34,7 +34,7 @@
     inline bool       completed(){ return localState.completed != 0 && remoteState.completed != 0; }
     inline bool       ok(){ return localState.error == 0 && remoteState.error == 0; }
-    inline int        getHostId(){ return localState.hostId; }
-    inline int        getNetworkGameManagerId(){ return localState.networkManagerId; }
-    inline void       doReject( std::string reason ){ remoteState.error = 1; remoteState.errorString = "the server rejected your connection ["+ reason +"]"; }
+    inline int        getHostId(){ return remoteState.hostId; }
+    inline int        getNetworkGameManagerId(){ return remoteState.networkManagerId; }
+    inline void       doReject( std::string reason ){ localState.error = 1; localState.errorString = "the server rejected your connection ["+ reason +"]"; }
     
     virtual void varChangeHandler( std::list<int> & id );
Index: branches/network/src/lib/network/network_stream.cc
===================================================================
--- branches/network/src/lib/network/network_stream.cc	(revision 7590)
+++ branches/network/src/lib/network/network_stream.cc	(revision 7591)
@@ -142,5 +142,5 @@
   peers[0].handshake = hs;
 //   peers[0].handshake->setSynchronized( true );
-  this->connectSynchronizeable(*hs);
+  //this->connectSynchronizeable(*hs);
   //this->connectSynchronizeable(*hs);
   PRINTF(0)("NetworkStream: Handshake created: %s\n", hs->getName());
@@ -508,5 +508,5 @@
     {
       Synchronizeable & sync = **it;
-
+      
       if ( !sync.beSynchronized() || sync.getUniqueID() < 0 )
         continue;
@@ -515,7 +515,8 @@
       if ( peer->second.handshake && sync.getLeafClassID() != CL_HANDSHAKE )
         continue;
-
-      PRINTF(0)("syncing: id:%d name:%s\n", sync.getUniqueID(), sync.getClassName());
-      
+      
+      if ( isServer() && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
+        continue;
+
       assert( offset + INTSIZE <= UDP_PACKET_SIZE );
       
@@ -644,5 +645,4 @@
         }
       }
-      
       offset += sync->setStateDiff( peer->second.userId, buf+offset, length-offset, state, fromState );
     }
Index: branches/network/src/lib/network/synchronizeable.cc
===================================================================
--- branches/network/src/lib/network/synchronizeable.cc	(revision 7590)
+++ branches/network/src/lib/network/synchronizeable.cc	(revision 7591)
@@ -126,6 +126,6 @@
   while ( it != sentStates[userId].end() && (*it)->stateId < fromStateId )
     it++;
-  ///FIXED: altered begin() -> end()
-  if ( it != sentStates[userId].end() )
+
+  if ( it != sentStates[userId].begin() )
   {
     for ( StateHistory::iterator it2 = sentStates[userId].begin(); it2 != it; it2++ )
@@ -209,4 +209,6 @@
 
   sentStates[userId].push_back( stateTo );
+  
+  assert( i == neededSize );
 
   //write diff to data
@@ -229,8 +231,8 @@
  * @param stateId id of current state
  * @param fromStateId id of the base state id
- * @return true on success
+ * @return number bytes read
  * @todo check for permissions
  */
-bool Synchronizeable::setStateDiff( int userId, byte* data, int length, int stateId, int fromStateId )
+int Synchronizeable::setStateDiff( int userId, byte* data, int length, int stateId, int fromStateId )
 {
   //make sure this user has his history
@@ -309,5 +311,5 @@
   this->varChangeHandler( changes );
   
-  return length;
+  return i;
 }
 
Index: branches/network/src/lib/network/synchronizeable.h
===================================================================
--- branches/network/src/lib/network/synchronizeable.h	(revision 7590)
+++ branches/network/src/lib/network/synchronizeable.h	(revision 7591)
@@ -63,5 +63,5 @@
 
     int getStateDiff( int userId, byte* data, int maxLength, int stateId, int fromStateId, int priorityTH );
-    bool setStateDiff( int userId, byte* data, int length, int stateId, int fromStateId );
+    int setStateDiff( int userId, byte* data, int length, int stateId, int fromStateId );
 
     void registerVar( SynchronizeableVar * var );
