Skip to content

Commit

Permalink
Improve debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
d3x0r committed Sep 12, 2024
1 parent 8d29e3b commit 06ed86d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/netlib/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ void TerminateClosedClientEx( PCLIENT pc DBG_PASS )
if( IsValid( pc->Socket ) )
{
#ifdef VERBOSE_DEBUG
lprintf( "close soekcet." );
lprintf( "close socket: %p", pc );
#endif
#if !defined( SHUT_WR ) && defined( _WIN32 )
# define SHUT_WR SD_SEND
Expand Down Expand Up @@ -1336,9 +1336,9 @@ void InternalRemoveClientExx(PCLIENT lpClient, LOGICAL bBlockNotify, LOGICAL bLi
return;
}
if( bLinger && ( lpClient->lpFirstPending || ( lpClient->dwFlags & CF_WRITEPENDING ) ) ) {
//#ifdef LOG_DEBUG_CLOSING
lprintf( "GRACEFUL CLOSE WHILE WAITING FOR WRITE TO FINISH..." );
//#endif
#ifdef LOG_DEBUG_CLOSING
lprintf( "GRACEFUL CLOSE WHILE WAITING FOR WRITE TO FINISH... %p", lpClient );
#endif
lpClient->dwFlags |= CF_TOCLOSE;
return;
// continue on; otherwise the close event gets lost...
Expand Down Expand Up @@ -1387,7 +1387,7 @@ void InternalRemoveClientExx(PCLIENT lpClient, LOGICAL bBlockNotify, LOGICAL bLi
if( !(lpClient->dwFlags & CF_CLOSING) ) // prevent multiple notifications...
{
#ifdef LOG_DEBUG_CLOSING
lprintf( "Marked closing first, and dispatching callback?" );
lprintf( "Marked closing first, and dispatching callback? %p", lpClient );
#endif
lpClient->dwFlags |= CF_CLOSING;
LeaveCriticalSec( &globalNetworkData.csNetwork );
Expand Down
1 change: 1 addition & 0 deletions src/netlib/network_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ static void HandleEvent( PCLIENT pClient )
pClient->dwFlags &= ~CF_TOCLOSE;
//lprintf( "Pending read failed - and wants to close." );
EnterCriticalSec( &globalNetworkData.csNetwork );
// remote shutdown triggered this... and somehow this shouldn't be the same as a graceful close.
InternalRemoveClientEx( pClient, FALSE, TRUE );
TerminateClosedClient( pClient );
LeaveCriticalSec( &globalNetworkData.csNetwork );
Expand Down
6 changes: 3 additions & 3 deletions src/netlib/tcpnetwork.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,9 +1426,9 @@ int TCPWriteEx(PCLIENT pc DBG_PASS)
if (nSent == SOCKET_ERROR) {
if( dwError == WSAEWOULDBLOCK ) // this is alright.
{
//#ifdef VERBOSE_DEBUG
lprintf( "Pending write...(EBLOCK) %p", pc );
//#endif
#ifdef VERBOSE_DEBUG
lprintf( "Pending write...(EBLOCK) %p %zd", pc, pc->lpFirstPending->dwAvail );
#endif
pc->dwFlags &= ~CF_WRITEREADY;
pc->dwFlags |= CF_WRITEPENDING;
return TRUE;
Expand Down

0 comments on commit 06ed86d

Please sign in to comment.