Skip to content

Commit 08e5d9e

Browse files
authored
Merge pull request #104 from ViktorTigerstrom/2024-02-modify-gbn-logger
gbn: make logger more informative in `debug` level
2 parents f135fdc + 1249f0f commit 08e5d9e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

gbn/queue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (q *queue) resend() error {
136136
// Prepare the queue for awaiting the resend catch up.
137137
q.syncer.initResendUpTo(top)
138138

139-
q.cfg.log.Tracef("Resending the queue")
139+
q.cfg.log.Debugf("Resending the packets queue")
140140

141141
for base != top {
142142
packet := q.content[base]

gbn/syncer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,12 @@ func (c *syncer) waitForSync() {
208208
return
209209

210210
case <-c.cancel:
211-
c.log.Tracef("sync canceled or reset")
211+
c.log.Debugf("Sync completed")
212212

213213
case <-time.After(
214214
c.timeoutManager.GetResendTimeout() * awaitingTimeoutMultiplier,
215215
):
216-
c.log.Tracef("Timed out while waiting for sync")
216+
c.log.Debugf("Timed out while waiting for sync")
217217
}
218218

219219
c.reset()

gbn/timeout_manager.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ func (m *TimeoutManager) Sent(msg Message, resent bool) {
306306
// we're resending the SYN message. This might occur multiple
307307
// times until we receive the corresponding response.
308308
m.handshakeBooster.Boost()
309+
m.log.Debugf("Boosted handshakeTimeout to %v",
310+
m.handshakeBooster.GetCurrentTimeout())
309311

310312
case *PacketData:
311313
m.sentTimesMu.Lock()
@@ -319,6 +321,8 @@ func (m *TimeoutManager) Sent(msg Message, resent bool) {
319321
delete(m.sentTimes, msg.Seq)
320322

321323
m.resendBooster.Boost()
324+
m.log.Debugf("Boosted resendTimeout to %v",
325+
m.resendBooster.GetCurrentTimeout())
322326

323327
return
324328
}
@@ -411,7 +415,7 @@ func (m *TimeoutManager) updateResendTimeoutUnsafe(responseTime time.Duration) {
411415
multipliedTimeout = minimumResendTimeout
412416
}
413417

414-
m.log.Tracef("Updating resendTimeout to %v", multipliedTimeout)
418+
m.log.Debugf("Updating resendTimeout to %v", multipliedTimeout)
415419

416420
m.resendTimeout = multipliedTimeout
417421

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

429433
resendTimeout := m.resendBooster.GetCurrentTimeout()
430434

431-
m.log.Debugf("Returning resendTimeout %v", resendTimeout)
432-
433435
return resendTimeout
434436
}
435437

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

441443
handshake := m.handshakeBooster.GetCurrentTimeout()
442444

443-
m.log.Debugf("Returning handshakeTimeout %v", handshake)
444-
445445
return handshake
446446
}
447447

0 commit comments

Comments
 (0)