Index: branches/proxy/src/lib/network/network_manager.cc
===================================================================
--- branches/proxy/src/lib/network/network_manager.cc	(revision 9420)
+++ branches/proxy/src/lib/network/network_manager.cc	(revision 9422)
@@ -165,5 +165,5 @@
   this->networkStream->startHandshake();
 
-  PRINTF(0)("Created Network Client");
+  PRINTF(0)("Created Network Client\n");
   return 1;
 }
Index: branches/proxy/src/lib/network/network_stream.cc
===================================================================
--- branches/proxy/src/lib/network/network_stream.cc	(revision 9420)
+++ branches/proxy/src/lib/network/network_stream.cc	(revision 9422)
@@ -236,11 +236,12 @@
  * handsakes are always initialized from the client side first. this starts the handshake and therefore is only
  * executed as client
- */
-void NetworkStream::startHandshake()
+ * @param userId: start handshake for this user id (optional, default == 0)
+ */
+void NetworkStream::startHandshake(int userId)
 {
   Handshake* hs = new Handshake(this->pInfo->nodeType);
   hs->setUniqueID( 0 );
-  assert( peers[0].handshake == NULL );
-  peers[0].handshake = hs;
+  assert( peers[userId].handshake == NULL );
+  peers[userId].handshake = hs;
 
   // set the preferred nick name
@@ -255,4 +256,5 @@
  * it all over the network and creating it on the other platforms (if and only if it is a
  * server
+ * @param sync: the synchronizeable to add
  */
 void NetworkStream::connectSynchronizeable(Synchronizeable& sync)
@@ -260,6 +262,4 @@
   this->synchronizeables.push_back(&sync);
   sync.setNetworkStream( this );
-
-//   this->bActive = true;
 }
 
@@ -267,4 +267,5 @@
 /**
  * removes the synchronizeable from the list of synchronized entities
+ * @param sync: the syncronizeable to remove
  */
 void NetworkStream::disconnectSynchronizeable(Synchronizeable& sync)
@@ -434,18 +435,18 @@
 
 #warning this is some more disconnct handling, consider doing it in the handleDisconnect() funciton
-      // and cleanup the user infos
-      for ( SynchronizeableList::iterator it2 = synchronizeables.begin(); it2 != synchronizeables.end(); it2++ )
-      {
-        (*it2)->cleanUpUser( it->second.userId );
-      }
-
-      NetworkGameManager::getInstance()->signalLeftPlayer(it->second.userId);
-
-      freeSocketSlots.push_back( it->second.userId );
-
-      PeerList::iterator delit = it;
-      it++;
-
-      peers.erase( delit );
+//       // and cleanup the user infos
+//       for ( SynchronizeableList::iterator it2 = synchronizeables.begin(); it2 != synchronizeables.end(); it2++ )
+//       {
+//         (*it2)->cleanUpUser( it->second.userId );
+//       }
+//
+//       NetworkGameManager::getInstance()->signalLeftPlayer(it->second.userId);
+//
+//       freeSocketSlots.push_back( it->second.userId );
+//
+//       PeerList::iterator delit = it;
+//       it++;
+//
+//       peers.erase( delit );
 
       continue;
@@ -532,17 +533,24 @@
 
               // now check if the server accepted the connection
-              if( it->second.handshake->redirect())
+              if( !it->second.handshake->redirect())
+              {
+                // create the new network game manager and init it
+                this->networkGameManager = NetworkGameManager::getInstance();
+                this->networkGameManager->setUniqueID( it->second.handshake->getNetworkGameManagerId() );
+              // init the new message manager
+                MessageManager::getInstance()->setUniqueID( it->second.handshake->getMessageManagerId() );
+
+                PRINT(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId());
+                it->second.handshake->del();
+              }
+              else
                 this->handleReconnect( it->second.userId);
 
-              // create the new network game manager and init it
-              this->networkGameManager = NetworkGameManager::getInstance();
-              this->networkGameManager->setUniqueID( it->second.handshake->getNetworkGameManagerId() );
-              // init the new message manager
-              MessageManager::getInstance()->setUniqueID( it->second.handshake->getMessageManagerId() );
             }
-
-
-            PRINT(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId());
-            it->second.handshake->del();
+            else
+              assert(false);
+
+
+
           }
           else
@@ -609,4 +617,5 @@
   PRINTF(0)("===============================================\n");
   PRINTF(0)("Client is redirected to the other proxy servers\n");
+  PRINTF(0)("  user id: %i\n", userId);
   PRINTF(0)("  connecting to: %s\n", pInfo->handshake->getProxy1Address().ipString().c_str());
   PRINTF(0)("===============================================\n");
@@ -622,13 +631,12 @@
   IP proxyIP = pInfo->handshake->getProxy1Address();
 
-  // not sure if this works as expected
-  if( pInfo->handshake)
-    delete pInfo->handshake;
-
   // disconnect from the current server and reconnect to proxy server
-  pInfo->socket->reconnectToServer( proxyIP.ipString(), proxyIP.port());
+//   pInfo->socket->reconnectToServer( proxyIP.ipString(), proxyIP.port());
+  this->handleDisconnect( userId);
+//   this->connectToProxyServer(proxyIP.ipString(), 9999);
+#warning the ports are not yet integrated correctly in the ip class
 
   // and restart the handshake
-  this->startHandshake();
+//   this->startHandshake( userId);
 }
 
@@ -651,4 +659,15 @@
     delete peers[userId].connectionMonitor;
   peers[userId].connectionMonitor = NULL;
+
+
+  for ( SynchronizeableList::iterator it2 = synchronizeables.begin(); it2 != synchronizeables.end(); it2++ )  {
+    (*it2)->cleanUpUser( userId );
+  }
+
+//   NetworkGameManager::getInstance()->signalLeftPlayer(userId);
+
+  this->freeSocketSlots.push_back( userId );
+
+  peers.erase( userId );
 }
 
Index: branches/proxy/src/lib/network/network_stream.h
===================================================================
--- branches/proxy/src/lib/network/network_stream.h	(revision 9420)
+++ branches/proxy/src/lib/network/network_stream.h	(revision 9422)
@@ -46,5 +46,5 @@
 
     void createNetworkGameManager();
-    void startHandshake();
+    void startHandshake(int userId = 0);
 
     /* synchronizeable interface */
