- Timestamp:
- Apr 7, 2011, 4:18:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/masterserver2/src/libraries/network/MasterServer.cc
r8163 r8202 52 52 { 53 53 /* get an iterator */ 54 std::list< packet::ServerInformation>::iterator i;54 std::list<ServerListElem>::iterator i; 55 55 56 56 /* packet holder */ … … 63 63 /* send this particular server */ 64 64 /* build reply string */ 65 char *tosend = (char *)calloc( (*i). getServerIP().length()65 char *tosend = (char *)calloc( (*i).ServerInfo.getServerIP().length() 66 66 + MSPROTO_SERVERLIST_ITEM_LEN + 2,1 ); 67 67 if( !tosend ) … … 70 70 } 71 71 sprintf( tosend, "%s %s", MSPROTO_SERVERLIST_ITEM, 72 (*i). getServerIP().c_str() );72 (*i).ServerInfo.getServerIP().c_str() ); 73 73 74 74 /* create packet from it */ … … 104 104 */ 105 105 void 106 MasterServer::helper_ pingServers( void)106 MasterServer::helper_cleanupServers() 107 107 { 108 108 /* get an iterator */ 109 std::list<packet::ServerInformation>::iterator i; 109 std::list<ServerListElem>::iterator i; 110 110 111 /* loop through list elements */ 111 112 for( i = mainlist.serverlist.begin(); i 112 113 != mainlist.serverlist.end(); ++i ) 113 114 { 114 /* to be implemented, waiting for Oli to reply to my email - sandro */ 115 115 if( mainlist.serverlist.size() != 0 && (*i).peer && 116 ((*i).peer->state == ENET_PEER_STATE_DISCONNECTED || 117 (*i).peer->state == ENET_PEER_STATE_ZOMBIE )) 118 { mainlist.delServerByName( (*i).ServerInfo.getServerName() ); 119 COUT(2) << "someone timed out.\n"; 120 } 116 121 } 117 122 118 }119 120 void121 MasterServer::helper_cleanupServers()122 {123 /* same as above. */124 125 123 } 126 124 … … 165 163 166 164 /* output that the disconnect happened */ 167 COUT( 4) << (char*)event->peer->data << " disconnected.\n";165 COUT(2) << (char*)event->peer->data << " disconnected.\n"; 168 166 169 167 /* create string from peer data */ … … 205 203 MSPROTO_REGISTER_SERVER, MSPROTO_REGISTER_SERVER_LEN ) ) 206 204 { /* register new server */ 207 mainlist.addServer( packet::ServerInformation( event ) ); 205 mainlist.addServer( packet::ServerInformation( event ), 206 event->peer ); 208 207 209 208 /* tell people we did so */ … … 260 259 } 261 260 262 /* TODO schedule pings for servers somewhere here */263 /* Iterate through servers and send pings */264 helper_pingServers();265 266 261 /* check for timed out pings and remove those guys from 267 262 * the server list
Note: See TracChangeset
for help on using the changeset viewer.