Index: /code/branches/presentation/src/libraries/network/MasterServer.cc
===================================================================
--- /code/branches/presentation/src/libraries/network/MasterServer.cc	(revision 7762)
+++ /code/branches/presentation/src/libraries/network/MasterServer.cc	(revision 7763)
@@ -186,4 +186,18 @@
       }
 
+      else if( !strncmp( (char *)event->packet->data
+        + MSPROTO_GAME_SERVER_LEN+1,
+        MSPROTO_SERVERDC, MSPROTO_SERVERDC_LEN ) )
+      {
+        /* create string from peer data */
+        std::string name = std::string( addrconv );
+
+        /* remove the server from the list it belongs to */
+        this->mainlist.delServerByName( name );
+
+        /* tell the user */
+        COUT(2) << "Removed server " << name << " from list.\n";
+      }
+
       /* TODO add hook for disconnect here */
     }
Index: /code/branches/presentation/src/libraries/network/MasterServerComm.cc
===================================================================
--- /code/branches/presentation/src/libraries/network/MasterServerComm.cc	(revision 7762)
+++ /code/branches/presentation/src/libraries/network/MasterServerComm.cc	(revision 7763)
@@ -41,5 +41,5 @@
   {
     /* initialize Enet */
-    if (enet_initialize () != 0)
+    if( enet_initialize () != 0 )
     { COUT(1) << "An error occurred while initializing ENet.\n";
       return 1;
@@ -59,5 +59,6 @@
     /* see if it worked */
     if (this->client == NULL)
-    { COUT(1) << "An error occurred while trying to create an ENet client host.\n";
+    { COUT(1) << "An error occurred while trying to create an " 
+        << "ENet client host.\n";
       return 1;
     }
@@ -70,7 +71,4 @@
     /* destroy the enet facilities */
     enet_host_destroy(this->client);
-
-    /* install atexit handler for enet */
-    enet_deinitialize();
   }
 
@@ -84,6 +82,7 @@
     this->peer = enet_host_connect(this->client, &this->address, 2, 0);    
 
-    if (this->peer == NULL )
-    { COUT(2) << "ERROR: No available peers for initiating an ENet connection.\n";
+    if( this->peer == NULL )
+    { COUT(2) << "ERROR: No available peers for initiating an ENet"
+        << " connection.\n";
       return -1;
     }
@@ -96,5 +95,4 @@
     {
       enet_peer_reset (this->peer);
-      fprintf( stdout, "Connection to %s failed.", address );
       COUT(2) << "ERROR: connection to " << address << " failed.\n";
       return -1;
@@ -240,5 +238,5 @@
     /* One could just use enet_host_service() instead. */
     enet_host_flush( this->client );
-    if( packet ) free( packet );
+    enet_packet_destroy( packet );
 
     /* all done. */
Index: /code/branches/presentation/src/libraries/network/MasterServerComm.h
===================================================================
--- /code/branches/presentation/src/libraries/network/MasterServerComm.h	(revision 7762)
+++ /code/branches/presentation/src/libraries/network/MasterServerComm.h	(revision 7763)
@@ -66,5 +66,5 @@
        * Disconnect from master server.
        */
-      int disconnect();
+      int disconnect( void );
 
       /** \param data The data to be sent. 
Index: /code/branches/presentation/src/libraries/network/MasterServerProtocol.h
===================================================================
--- /code/branches/presentation/src/libraries/network/MasterServerProtocol.h	(revision 7762)
+++ /code/branches/presentation/src/libraries/network/MasterServerProtocol.h	(revision 7763)
@@ -69,4 +69,8 @@
 #define MSPROTO_PING_GAMESERVER_LEN 4 
 
+/* server disconnect */
+#define MSPROTO_SERVERDC "DC"
+#define MSPROTO_SERVERDC_LEN 2
+
 /* ping reply */
 #define MSPROTO_ACK "ACK"
Index: /code/branches/presentation/src/libraries/network/Server.cc
===================================================================
--- /code/branches/presentation/src/libraries/network/Server.cc	(revision 7762)
+++ /code/branches/presentation/src/libraries/network/Server.cc	(revision 7763)
@@ -104,19 +104,21 @@
   void Server::helper_ConnectToMasterserver()
   {
-    /* initialize it and see if it worked */
-    if( msc.initialize() )
-    { COUT(1) << "Error: could not initialize master server communications!\n";
-      return;
-    }
-
-    /* connect and see if it worked */
-    if( msc.connect( WANDiscovery::getInstance().getMSAddress().c_str(), 
-      ORX_MSERVER_PORT ) )
-    { COUT(1) << "Error: could not connect to master server!\n";
-      return;
-    }
+    //[> initialize it and see if it worked <]
+    //if( msc.initialize() )
+    //{ COUT(1) << "Error: could not initialize master server communications!\n";
+      //return;
+    //}
+
+    //[> connect and see if it worked <]
+    //if( msc.connect( WANDiscovery::getInstance().getMSAddress().c_str(), 
+      //ORX_MSERVER_PORT ) )
+    //{ COUT(1) << "Error: could not connect to master server!\n";
+      //return;
+    //}
 
     /* now send the master server some note we're here */
-    msc.sendRequest( MSPROTO_GAME_SERVER " " MSPROTO_REGISTER_SERVER );
+    //msc.sendRequest( MSPROTO_GAME_SERVER " " MSPROTO_REGISTER_SERVER );
+    WANDiscovery::getInstance().msc.sendRequest( MSPROTO_GAME_SERVER " " 
+      MSPROTO_REGISTER_SERVER );
   }
 
@@ -152,7 +154,11 @@
     this->disconnectClients();
     this->closeListener();
+
+    /* tell master server we're closing */
     COUT(2) << "disconnecting." << endl;
-    this->msc.disconnect();
+    WANDiscovery::getInstance().msc.sendRequest( MSPROTO_GAME_SERVER " " 
+      MSPROTO_SERVERDC );
     COUT(2) << "disconnecting done" << endl;
+
     LANDiscoverable::setActivity(false);
     return;
@@ -196,5 +202,5 @@
      * has to be done or changed.
      */
-    this->msc.pollForReply( rephandler, 10 ); 
+    //WANDiscovery::getInstance().msc.pollForReply( rhandler, 10 );
   }
 
Index: /code/branches/presentation/src/libraries/network/Server.h
===================================================================
--- /code/branches/presentation/src/libraries/network/Server.h	(revision 7762)
+++ /code/branches/presentation/src/libraries/network/Server.h	(revision 7763)
@@ -90,5 +90,5 @@
 
     float timeSinceLastUpdate_;
-    MasterServerComm msc;
+    //MasterServerComm msc;
   };
 
Index: /code/branches/presentation/src/libraries/network/WANDiscovery.cc
===================================================================
--- /code/branches/presentation/src/libraries/network/WANDiscovery.cc	(revision 7762)
+++ /code/branches/presentation/src/libraries/network/WANDiscovery.cc	(revision 7763)
@@ -133,5 +133,5 @@
     {
       /* poll for reply and act according to what was received */
-      switch( this->msc.pollForReply( rhandler, 1000 ) )
+      switch( this->msc.pollForReply( rhandler, 500 ) )
       { case 0: /* no event occured, decrease timeout */
           --i; break;
Index: /code/branches/presentation/src/libraries/network/WANDiscovery.h
===================================================================
--- /code/branches/presentation/src/libraries/network/WANDiscovery.h	(revision 7762)
+++ /code/branches/presentation/src/libraries/network/WANDiscovery.h	(revision 7763)
@@ -95,11 +95,11 @@
       /** Function used for the configuration file parameter update */
       void setConfigValues();
+
+      /** Master server communications object */
+      MasterServerComm msc;
       
     private:
       /** Singleton pointer */
       static WANDiscovery* singletonPtr_s;
-
-      /** Master server communications object */
-      MasterServerComm msc;
 
       /** master server address */
