From 1249f0f8d5ad8cc60e87cb63ff4eae6724f076fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Tigerstr=C3=B6m?= Date: Thu, 8 Feb 2024 17:48:44 +0100 Subject: [PATCH] gbn: make logger more informative in `debug` level --- gbn/queue.go | 2 +- gbn/syncer.go | 4 ++-- gbn/timeout_manager.go | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gbn/queue.go b/gbn/queue.go index 0bbe654..8453989 100644 --- a/gbn/queue.go +++ b/gbn/queue.go @@ -136,7 +136,7 @@ func (q *queue) resend() error { // Prepare the queue for awaiting the resend catch up. q.syncer.initResendUpTo(top) - q.cfg.log.Tracef("Resending the queue") + q.cfg.log.Debugf("Resending the packets queue") for base != top { packet := q.content[base] diff --git a/gbn/syncer.go b/gbn/syncer.go index 2fd9dae..d025013 100644 --- a/gbn/syncer.go +++ b/gbn/syncer.go @@ -208,12 +208,12 @@ func (c *syncer) waitForSync() { return case <-c.cancel: - c.log.Tracef("sync canceled or reset") + c.log.Debugf("Sync completed") case <-time.After( c.timeoutManager.GetResendTimeout() * awaitingTimeoutMultiplier, ): - c.log.Tracef("Timed out while waiting for sync") + c.log.Debugf("Timed out while waiting for sync") } c.reset() diff --git a/gbn/timeout_manager.go b/gbn/timeout_manager.go index 121eece..e2f2502 100644 --- a/gbn/timeout_manager.go +++ b/gbn/timeout_manager.go @@ -306,6 +306,8 @@ func (m *TimeoutManager) Sent(msg Message, resent bool) { // we're resending the SYN message. This might occur multiple // times until we receive the corresponding response. m.handshakeBooster.Boost() + m.log.Debugf("Boosted handshakeTimeout to %v", + m.handshakeBooster.GetCurrentTimeout()) case *PacketData: m.sentTimesMu.Lock() @@ -319,6 +321,8 @@ func (m *TimeoutManager) Sent(msg Message, resent bool) { delete(m.sentTimes, msg.Seq) m.resendBooster.Boost() + m.log.Debugf("Boosted resendTimeout to %v", + m.resendBooster.GetCurrentTimeout()) return } @@ -411,7 +415,7 @@ func (m *TimeoutManager) updateResendTimeoutUnsafe(responseTime time.Duration) { multipliedTimeout = minimumResendTimeout } - m.log.Tracef("Updating resendTimeout to %v", multipliedTimeout) + m.log.Debugf("Updating resendTimeout to %v", multipliedTimeout) m.resendTimeout = multipliedTimeout @@ -428,8 +432,6 @@ func (m *TimeoutManager) GetResendTimeout() time.Duration { resendTimeout := m.resendBooster.GetCurrentTimeout() - m.log.Debugf("Returning resendTimeout %v", resendTimeout) - return resendTimeout } @@ -440,8 +442,6 @@ func (m *TimeoutManager) GetHandshakeTimeout() time.Duration { handshake := m.handshakeBooster.GetCurrentTimeout() - m.log.Debugf("Returning handshakeTimeout %v", handshake) - return handshake }