Drops an incoming connection correct when the host is full, resolves a FIXME.

master
Rene Jochum 2011-04-25 20:33:27 +02:00
parent 027229f5c9
commit 15b5b6a48f
1 changed files with 10 additions and 3 deletions

View File

@ -2309,14 +2309,20 @@ static void NETallowJoining(void)
NETstring(ModList, sizeof(ModList));
NETstring(GamePassword, sizeof(GamePassword));
NETend();
NETpop(NETnetTmpQueue(i));
tmp = NET_CreatePlayer(name);
if (tmp == -1)
{
// FIXME: No room. Dropping the player without warning since protocol doesn't seem to support rejection at this point
debug(LOG_ERROR, "freeing temp socket %p, couldn't create player!", tmp_socket[i]);
debug(LOG_ERROR, "freeing temp socket %p, couldn't create player!", tmp_socket[i]);
// Tell the player that we are full.
NETbeginEncode(NETnetTmpQueue(i), NET_REJECTED);
NETuint8_t((uint8_t *)ERROR_FULL);
NETend();
NETflush();
NETpop(NETnetTmpQueue(i));
SocketSet_DelSocket(tmp_socket_set, tmp_socket[i]);
socketClose(tmp_socket[i]);
tmp_socket[i] = NULL;
@ -2324,6 +2330,7 @@ static void NETallowJoining(void)
return;
}
NETpop(NETnetTmpQueue(i));
index = tmp;
debug(LOG_NET, "freeing temp socket %p (%d), creating permanent socket.", tmp_socket[i], __LINE__);