Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gbn: make logger more informative in debug level #104

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading