Skip to content

Commit

Permalink
Put debug logging behind debug symbol check
Browse files Browse the repository at this point in the history
  • Loading branch information
d3x0r committed Jul 30, 2024
1 parent 5ebc9b9 commit ce6ec92
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/netlib/tcpnetwork.c
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,7 @@ LOGICAL doTCPWriteV2( PCLIENT lpClient
}
if( !(lpClient->dwFlags & CF_ACTIVE ) )
{
//#ifdef VERBOSE_DEBUG
//#ifdef LOG_WRITE_AGGREGATION
lprintf( "TCP Write failed - client is inactive" );
//#endif
// change to inactive status by the time we got here...
Expand All @@ -1748,12 +1748,12 @@ LOGICAL doTCPWriteV2( PCLIENT lpClient

if( lpClient->lpFirstPending ) // will already be in a wait on network state...
{
//#ifdef VERBOSE_DEBUG
#ifdef LOG_WRITE_AGGREGATION
_lprintf( DBG_RELAY )( "Data already pending, pending buffer...%p %d", pInBuffer, nInLen );
//#endif
#endif
if( !failpending )
{
#ifdef VERBOSE_DEBUG
#ifdef LOG_WRITE_AGGREGATION
lprintf( "Queuing pending data anyhow..." );
#endif
// this doesn't re-trigger sending; it assumes the network write-ready event will do that.
Expand Down
12 changes: 11 additions & 1 deletion src/timerlib/timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#define MEMORY_STRUCT_DEFINED
#define DEFINE_MEMORY_STRUCT

//#define DEBUG_TIMER_RESCHEDULE

#define THREAD_STRUCTURE_DEFINED

#include <stdhdrs.h> // Sleep()
Expand Down Expand Up @@ -2240,7 +2242,9 @@ static void InternalRescheduleTimerEx( PTIMER timer, uint32_t delay )
// grabbing the timer this way should put its delta into the next.
PTIMER bGrabbed = GrabTimer( timer, FALSE );
if (globalTimerData.flags.away_in_timer && globalTimerData.CurrentTimerID == timer->ID) {
#ifdef DEBUG_TIMER_RESCHEDULE
lprintf("Timer is dispatched/close to being dispatched. %d", timer->ID);
#endif
timer->flags.bRescheduled = 1; // tracks reschedule during callback
}
timer->delta = (int32_t)delay; // should never pass a negative value here, but delta can be negative.
Expand Down Expand Up @@ -2274,7 +2278,9 @@ void RescheduleTimerEx( uint32_t ID, uint32_t delay )
if( !ID )
{
timer =globalTimerData.current_timer;
#ifdef DEBUG_TIMER_RESCHEDULE
lprintf("timer 0 specified - use current timer (if there is one?) %d", timer ? timer->ID : -1);
#endif
}
else
{
Expand All @@ -2288,11 +2294,15 @@ void RescheduleTimerEx( uint32_t ID, uint32_t delay )
// dispatched and we get here (timer itself rescheduling itself)
if( globalTimerData.current_timer && globalTimerData.current_timer->ID == ID )
timer = globalTimerData.current_timer;
#ifdef DEBUG_TIMER_RESCHEDULE
lprintf("timer is processing? %d %d", ID, timer ? timer->ID : -1);
#endif
}
#ifdef DEBUG_TIMER_RESCHEDULE
else {
lprintf("timer found to reschedule %d", timer ? timer->ID : -1);
lprintf("timer found to reschedule %d", timer ? timer->ID : -1);
}
#endif
}
InternalRescheduleTimerEx( timer, delay );
LeaveCriticalSec( &globalTimerData.csGrab );
Expand Down

0 comments on commit ce6ec92

Please sign in to comment.