Index: /code/branches/masterserver2/src/libraries/network/MasterServer.cc
===================================================================
--- /code/branches/masterserver2/src/libraries/network/MasterServer.cc	(revision 8201)
+++ /code/branches/masterserver2/src/libraries/network/MasterServer.cc	(revision 8202)
@@ -52,5 +52,5 @@
   {
     /* get an iterator */
-    std::list<packet::ServerInformation>::iterator i;
+    std::list<ServerListElem>::iterator i;
 
     /* packet holder */
@@ -63,5 +63,5 @@
       /* send this particular server */
       /* build reply string */
-      char *tosend = (char *)calloc( (*i).getServerIP().length() 
+      char *tosend = (char *)calloc( (*i).ServerInfo.getServerIP().length() 
           + MSPROTO_SERVERLIST_ITEM_LEN + 2,1 );
       if( !tosend ) 
@@ -70,5 +70,5 @@
       } 
       sprintf( tosend, "%s %s", MSPROTO_SERVERLIST_ITEM, 
-          (*i).getServerIP().c_str() );
+          (*i).ServerInfo.getServerIP().c_str() );
 
       /* create packet from it */
@@ -104,23 +104,21 @@
    */
   void 
-  MasterServer::helper_pingServers( void )
+  MasterServer::helper_cleanupServers()
   {
     /* get an iterator */
-    std::list<packet::ServerInformation>::iterator i;
+    std::list<ServerListElem>::iterator i;
+
     /* loop through list elements */
     for( i = mainlist.serverlist.begin(); i 
         != mainlist.serverlist.end(); ++i ) 
     {
-      /* to be implemented, waiting for Oli to reply to my email - sandro */
-    
+      if( mainlist.serverlist.size() != 0 && (*i).peer && 
+         ((*i).peer->state == ENET_PEER_STATE_DISCONNECTED ||
+          (*i).peer->state == ENET_PEER_STATE_ZOMBIE ))
+      { mainlist.delServerByName( (*i).ServerInfo.getServerName() );
+        COUT(2) << "someone timed out.\n";
+      }
     }
  
-  }
-
-  void 
-  MasterServer::helper_cleanupServers()
-  {
-    /* same as above. */
-
   }
 
@@ -165,5 +163,5 @@
 
     /* output that the disconnect happened */
-    COUT(4) << (char*)event->peer->data << " disconnected.\n";
+    COUT(2) << (char*)event->peer->data << " disconnected.\n";
 
     /* create string from peer data */
@@ -205,5 +203,6 @@
         MSPROTO_REGISTER_SERVER, MSPROTO_REGISTER_SERVER_LEN ) )
       { /* register new server */
-        mainlist.addServer( packet::ServerInformation( event ) );
+        mainlist.addServer( packet::ServerInformation( event ),
+          event->peer );
         
         /* tell people we did so */
@@ -260,8 +259,4 @@
     }
 
-    /* TODO schedule pings for servers somewhere here */
-    /* Iterate through servers and send pings */
-    helper_pingServers();
-    
     /* check for timed out pings and remove those guys from
      * the server list
Index: /code/branches/masterserver2/src/libraries/network/ServerList.cc
===================================================================
--- /code/branches/masterserver2/src/libraries/network/ServerList.cc	(revision 8201)
+++ /code/branches/masterserver2/src/libraries/network/ServerList.cc	(revision 8202)
@@ -40,6 +40,12 @@
 
   int 
-  ServerList::addServer( packet::ServerInformation toadd )
-  { this->serverlist.push_back( toadd ); 
+  ServerList::addServer( packet::ServerInformation toadd,
+    ENetPeer *peer )
+  { 
+    ServerListElem toAdd;
+    toAdd.ServerInfo = toadd;
+    toAdd.peer = peer;
+
+    this->serverlist.push_back( toAdd ); 
     return 0;
   }
@@ -49,9 +55,9 @@
   { 
     /* get an iterator */
-    std::list<packet::ServerInformation>::iterator i;
+    std::list<ServerListElem>::iterator i;
 
     /* loop through list elements */
     for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
-      if( (*i).getServerName() == name )
+      if( (*i).ServerInfo.getServerName() == name )
       { /* found this name, remove and quit */
         this->serverlist.erase( i );
@@ -64,9 +70,9 @@
   { 
     /* get an iterator */
-    std::list<packet::ServerInformation>::iterator i;
+    std::list<ServerListElem>::iterator i;
 
     /* loop through list elements */
-    for( i=serverlist.begin(); i != serverlist.end(); ++i ) 
-      if( (*i).getServerIP() == address )
+    for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
+      if( (*i).ServerInfo.getServerIP() == address )
       { /* found this name, remove and quit */
         this->serverlist.erase( i );
@@ -78,7 +84,7 @@
 
   /* sort by name */
-  bool sub_compare_names( packet::ServerInformation no1, 
-    packet::ServerInformation no2 )
-  { return no1.getServerName() > no2.getServerName(); }
+  bool sub_compare_names( ServerListElem no1, 
+    ServerListElem no2 )
+  { return no1.ServerInfo.getServerName() > no2.ServerInfo.getServerName(); }
 
   void ServerList::sortByName()
@@ -88,9 +94,8 @@
   
   /* sort by ping */
-  bool sub_compare_pings( packet::ServerInformation no1, 
-    packet::ServerInformation no2 )
+  bool sub_compare_pings( ServerListElem no1, 
+    ServerListElem no2 )
   { 
-    /* TODO */
-    return no1.getServerName() > no2.getServerName();
+    return no1.ServerInfo.getServerName() > no2.ServerInfo.getServerName();
   }
 
Index: /code/branches/masterserver2/src/libraries/network/ServerList.h
===================================================================
--- /code/branches/masterserver2/src/libraries/network/ServerList.h	(revision 8201)
+++ /code/branches/masterserver2/src/libraries/network/ServerList.h	(revision 8202)
@@ -37,4 +37,13 @@
 namespace orxonox 
 { 
+  struct ServerListElem 
+  {
+    /* server information (name, IP, etc) */
+    packet::ServerInformation ServerInfo;
+
+    /* peer pointer */
+    ENetPeer* peer;
+  };
+
   /** This class is keeps a list of game servers
    * and some info about them.
@@ -54,5 +63,6 @@
        * Add server to the game server list
        */
-      int addServer( packet::ServerInformation toadd );
+      int addServer( packet::ServerInformation toadd,
+        ENetPeer *peer );
 
       /** \param name Name of the server to remove
@@ -78,5 +88,5 @@
 
       /** the list of servers for internal storage */
-      std::list<packet::ServerInformation> serverlist;
+      std::list<ServerListElem> serverlist;
     private:
   };
