Skip to content

Commit

Permalink
gbn: make logger more informative in debug level
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorTigerstrom committed Feb 8, 2024
1 parent f135fdc commit 1249f0f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gbn/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions gbn/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
10 changes: 5 additions & 5 deletions gbn/timeout_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
}
Expand Down Expand Up @@ -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

Expand All @@ -428,8 +432,6 @@ func (m *TimeoutManager) GetResendTimeout() time.Duration {

resendTimeout := m.resendBooster.GetCurrentTimeout()

m.log.Debugf("Returning resendTimeout %v", resendTimeout)

return resendTimeout
}

Expand All @@ -440,8 +442,6 @@ func (m *TimeoutManager) GetHandshakeTimeout() time.Duration {

handshake := m.handshakeBooster.GetCurrentTimeout()

m.log.Debugf("Returning handshakeTimeout %v", handshake)

return handshake
}

Expand Down

0 comments on commit 1249f0f

Please sign in to comment.