Fix logic in handling return value of addSocket

When a socket set is full (in addSocket) print a debug message

This is the last change, part of, and closes #435

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7294 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2009-05-03 15:18:07 +00:00 committed by Git SVN Gateway
parent ba9d49acd5
commit 0bc6be39b1
1 changed files with 4 additions and 7 deletions

View File

@ -476,6 +476,8 @@ static bool addSocket(SocketSet* set, Socket* socket)
} }
} }
debug(LOG_ERROR, "Socket set full, no room left (max %zu)", set->len);
return false; return false;
} }
@ -2454,7 +2456,7 @@ static void NETregisterServer(int state)
{ {
debug(LOG_ERROR, "Couldn't create socket set for master server because: %s", strsockerror(getSockErr())); debug(LOG_ERROR, "Couldn't create socket set for master server because: %s", strsockerror(getSockErr()));
} }
if (!addSocket(masterset, rs_socket)) if (addSocket(masterset, rs_socket))
{ {
debug(LOG_NET,"TCP_AddSocket using socket set %p, socket %p", masterset, rs_socket); debug(LOG_NET,"TCP_AddSocket using socket set %p, socket %p", masterset, rs_socket);
} }
@ -2537,15 +2539,10 @@ static void NETallowJoining(void)
} }
debug(LOG_NET, "Created tmp_socket_set %p", tmp_socket_set); debug(LOG_NET, "Created tmp_socket_set %p", tmp_socket_set);
if (!addSocket(tmp_socket_set, tcp_socket)) if (addSocket(tmp_socket_set, tcp_socket))
{ {
debug(LOG_NET,"TCP_AddSocket using socket set %p, socket %p", tmp_socket_set, tcp_socket); debug(LOG_NET,"TCP_AddSocket using socket set %p, socket %p", tmp_socket_set, tcp_socket);
} }
else
{
// Should never fail, or we will have major problems.
debug(LOG_ERROR,"SDLNet_AddSocket: %s\n", strsockerror(getSockErr()));
}
} }
if (checkSockets(tmp_socket_set, NET_READ_TIMEOUT) > 0) if (checkSockets(tmp_socket_set, NET_READ_TIMEOUT) > 0)