From ec4fdd29934a00285aa603baf849a66948fe828f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Tigerstr=C3=B6m?= Date: Thu, 9 Nov 2023 11:24:41 +0100 Subject: [PATCH] gbn: increase defaultHandshakeTimeout to 1 second Currently, the queue handshake timeout is cannot be set through options, so it is always set to the defaultHandshakeTimeout. The queue handshake timeout is used when determining if the queue should be resent or not, and defines minimum time we need to wait before resending the queue again. The value prior to this commit was 100ms, which is too low to make an impact, as it's unlikely that we'll try to resend the queue within 100ms of the last time we sent it. --- gbn/gbn_conn.go | 2 +- gbn/queue.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gbn/gbn_conn.go b/gbn/gbn_conn.go index 98b9ff5e..f561e54d 100644 --- a/gbn/gbn_conn.go +++ b/gbn/gbn_conn.go @@ -19,7 +19,7 @@ var ( const ( DefaultN = 20 - defaultHandshakeTimeout = 100 * time.Millisecond + defaultHandshakeTimeout = 1000 * time.Millisecond defaultResendTimeout = 2000 * time.Millisecond finSendTimeout = 1000 * time.Millisecond defaultResendMultiplier = 5 diff --git a/gbn/queue.go b/gbn/queue.go index af5a2229..3f1e04a0 100644 --- a/gbn/queue.go +++ b/gbn/queue.go @@ -39,7 +39,10 @@ type queue struct { // topMtx is used to guard sequenceTop. topMtx sync.RWMutex - lastResend time.Time + lastResend time.Time + + // handshakeTimeout defines minimum time we need to wait before + // resending the queue again, since the last time we resent it. handshakeTimeout time.Duration }