Some more nq networking debug prints.

This commit is contained in:
Bill Currie 2011-08-02 17:36:38 +09:00
parent 3898f5fd5c
commit 6f0ab844ea
3 changed files with 8 additions and 0 deletions

View file

@ -491,6 +491,7 @@ NET_Close (qsocket_t *sock)
// call the driver_Close function
sfunc.Close (sock);
Sys_MaskPrintf (SYS_NET, "closing socket\n");
NET_FreeQSocket (sock);
}
@ -524,6 +525,7 @@ NET_GetMessage (qsocket_t *sock)
// see if this connection has timed out
if (ret == 0 && sock->driver) {
if (net_time - sock->lastMessageTime > net_messagetimeout->value) {
Sys_MaskPrintf (SYS_NET, "socket timed out\n");
NET_Close (sock);
return -1;
}

View file

@ -1025,6 +1025,8 @@ _Datagram_CheckNewConnections (void)
}
// it's somebody coming back in from a crash/disconnect
// so close the old qsocket and let their retry get them back in
Sys_MaskPrintf (SYS_NET, "closing stale socket %d %g\n", ret,
net_time - s->connecttime);
NET_Close (s);
return NULL;
}
@ -1050,11 +1052,13 @@ _Datagram_CheckNewConnections (void)
// allocate a network socket
newsock = dfunc.OpenSocket (0);
if (newsock == -1) {
Sys_MaskPrintf (SYS_NET, "failed to open socket");
NET_FreeQSocket (sock);
return NULL;
}
// connect to the client
if (dfunc.Connect (newsock, &clientaddr) == -1) {
Sys_MaskPrintf (SYS_NET, "failed to connect client");
dfunc.CloseSocket (newsock);
NET_FreeQSocket (sock);
return NULL;
@ -1361,6 +1365,7 @@ _Datagram_Connect (const char *host)
ErrorReturn:
// FIXME: MENUCODE - do something with reason
Sys_MaskPrintf (SYS_NET, "FIXME: MENUCODE - do something with reason\n");
NET_FreeQSocket (sock);
ErrorReturn2:
dfunc.CloseSocket (newsock);

View file

@ -432,6 +432,7 @@ SV_DropClient (qboolean crash)
Sys_Printf ("Client %s removed\n", host_client->name);
}
// break the net connection
Sys_MaskPrintf (SYS_NET, "dropping client\n");
NET_Close (host_client->netconnection);
host_client->netconnection = NULL;