From 8bb1334a87fdc413940a1a54d63564d52ad657e7 Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 6 Dec 2024 20:44:28 +0000 Subject: [PATCH] Avoid printing junk timeouts in Nsock debug output --- nsock/src/nsock_core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nsock/src/nsock_core.c b/nsock/src/nsock_core.c index 4107a0bad..e6abfa3bd 100644 --- a/nsock/src/nsock_core.c +++ b/nsock/src/nsock_core.c @@ -1016,7 +1016,9 @@ void process_event(struct npool *nsp, gh_list_t *evlist, struct nevent *nse, int nsock_log_debug_all("Processing event %lu (timeout in %ldms, done=%d)", nse->id, - (long)TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod), + nse->timeout.tv_sec + ? (long)TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod) + : -1, nse->event_done); if (!nse->event_done) { @@ -1217,7 +1219,9 @@ const struct timeval *nsock_gettimeofday() { void nsock_pool_add_event(struct npool *nsp, struct nevent *nse) { nsock_log_debug("NSE #%lu: Adding event (timeout in %ldms)", nse->id, - (long)TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod)); + nse->timeout.tv_sec + ? (long)TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod) + : -1); nsp->events_pending++;