Skip to content

Commit e6729a4

Browse files
committed
Fixes for master server crashes
1 parent bb80e21 commit e6729a4

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/parsec_server/MasterServer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
MasterServer::MasterServer() {
8383
// TODO Auto-generated constructor stub
8484
last_check=0;
85+
ServerList.clear();
8586
}
8687

8788
MasterServer::MasterServer(E_GameServer* gameserver) {
@@ -121,5 +122,5 @@ int MasterServer::RemoveStaleEntries(){
121122
}
122123
last_check=curr_check;
123124
}
124-
125+
return 0;
125126
}

src/parsec_server/e_packethandler.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,17 +1174,20 @@ int E_PacketHandler::_ParseHBPacket_MASTER(char* recvline) {
11741174
// check to see if the server already exists in the ServerList. If so, update it. If not, add it.
11751175
// if the info doesn't match, ignore the packet
11761176
int i = 0;
1177-
for(i=0; i<TheMaster->ServerList.size(); i++){
1177+
std::vector<MasterServerItem>::iterator it=TheMaster->ServerList.begin();
1178+
std::vector<MasterServerItem>::iterator it_end=TheMaster->ServerList.end();
1179+
1180+
for(it; it != it_end; ++it){
11781181

11791182

1180-
word SrvID = (word)TheMaster->ServerList[i].GetSrvID();
1183+
word SrvID = (word)it->GetSrvID();
11811184
if(SrvID == ServerID) {
11821185
// double check the ID against the node address.
11831186
node_t node_ck;
1184-
TheMaster->ServerList[i].GetNode(&node_ck);
1187+
it->GetNode(&node_ck);
11851188
if(NODE_AreSame(&node_ck, &_Node)){
11861189
// they are the same, so update the record in the server list
1187-
TheMaster->ServerList[i].update(ServerID,CurrPlayers,MaxPlayers,PMajor,PMinor,ServerName,OS,&_Node);
1190+
it->update(ServerID,CurrPlayers,MaxPlayers,PMajor,PMinor,ServerName,OS,&_Node);
11881191
return TRUE;
11891192
} else {
11901193
// if we get here, the requested ServerID exists, but the node address

0 commit comments

Comments
 (0)