Index: /branches/proxy/src/lib/network/network_manager.cc
===================================================================
--- /branches/proxy/src/lib/network/network_manager.cc	(revision 9424)
+++ /branches/proxy/src/lib/network/network_manager.cc	(revision 9425)
@@ -137,5 +137,4 @@
 
 
-
   // start the network game manager
   this->networkStream->createNetworkGameManager();
Index: /branches/proxy/src/lib/network/network_stream.cc
===================================================================
--- /branches/proxy/src/lib/network/network_stream.cc	(revision 9424)
+++ /branches/proxy/src/lib/network/network_stream.cc	(revision 9425)
@@ -201,4 +201,6 @@
 {
   int node = this->peers.size();
+  PRINTF(0)("connect to proxy %s, this is node %i\n", host.c_str(), node);
+
   this->peers[node].socket = new UdpSocket( host, port );
   this->peers[node].userId = 0;
@@ -517,39 +519,33 @@
           if ( !it->second.handshake->allowDel() )
           {
-
-            if ( this->pInfo->isClient() )
+            // make sure this is a client
+            assert( this->pInfo->isClient());
+
+            SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() );
+            this->pInfo->userId = SharedNetworkData::getInstance()->getHostID();
+
+            it->second.nodeType = it->second.handshake->getRemoteNodeType();
+            it->second.ip = it->second.socket->getRemoteAddress();
+              // add the new server to the nodes list (it can be a NET_MASTER_SERVER or NET_PROXY_SERVER)
+            this->networkMonitor->addNode(&it->second);
+              // get proxy 1 address and add it
+            this->networkMonitor->addNode(it->second.handshake->getProxy1Address(), NET_PROXY_SERVER_ACTIVE);
+              // get proxy 2 address and add it
+            this->networkMonitor->addNode(it->second.handshake->getProxy2Address(), NET_PROXY_SERVER_ACTIVE);
+
+              // now check if the server accepted the connection
+            if( !it->second.handshake->redirect())
             {
-              SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() );
-              this->pInfo->userId = SharedNetworkData::getInstance()->getHostID();
-
-              it->second.nodeType = it->second.handshake->getRemoteNodeType();
-              it->second.ip = it->second.socket->getRemoteAddress();
-              // add the new server to the nodes list (it can be a NET_MASTER_SERVER or NET_PROXY_SERVER)
-              this->networkMonitor->addNode(&it->second);
-              // get proxy 1 address and add it
-              this->networkMonitor->addNode(it->second.handshake->getProxy1Address(), NET_PROXY_SERVER_ACTIVE);
-              // get proxy 2 address and add it
-              this->networkMonitor->addNode(it->second.handshake->getProxy2Address(), NET_PROXY_SERVER_ACTIVE);
-
-              // now check if the server accepted the connection
-              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() );
+              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);
-
+              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);
-
-
+              this->handleReconnect( it->second.userId);
 
           }
@@ -623,4 +619,5 @@
   // reject the server
   pInfo->handshake->doReject( "redirected to different server");
+  pInfo->handshake->del();
 
   // flush the old synchronization states, since the numbering could be completely different
@@ -634,9 +631,9 @@
 //   pInfo->socket->reconnectToServer( proxyIP.ipString(), proxyIP.port());
   this->handleDisconnect( userId);
-//   this->connectToProxyServer(proxyIP.ipString(), 9999);
+  this->connectToProxyServer(proxyIP.ipString(), 9999);
 #warning the ports are not yet integrated correctly in the ip class
 
   // and restart the handshake
-//   this->startHandshake( userId);
+  this->startHandshake( userId);
 }
 
