Skip to content

Commit b033f3d

Browse files
committed
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.
1 parent 6a938aa commit b033f3d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

gbn/gbn_conn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var (
2020

2121
const (
2222
DefaultN = 20
23-
defaultHandshakeTimeout = 100 * time.Millisecond
23+
defaultHandshakeTimeout = 1000 * time.Millisecond
2424
defaultResendTimeout = 2000 * time.Millisecond
2525
finSendTimeout = 1000 * time.Millisecond
2626
defaultResendMultiplier = 5

gbn/queue.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ type queue struct {
3939
// topMtx is used to guard sequenceTop.
4040
topMtx sync.RWMutex
4141

42-
lastResend time.Time
42+
lastResend time.Time
43+
44+
// handshakeTimeout defines minimum time we need to wait before
45+
// resending the queue again, since the last time we resent it.
4346
handshakeTimeout time.Duration
4447
}
4548

0 commit comments

Comments
 (0)