Skip to content

Commit 13d35f1

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 df4cb36 commit 13d35f1

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
@@ -19,7 +19,7 @@ var (
1919

2020
const (
2121
DefaultN = 20
22-
defaultHandshakeTimeout = 100 * time.Millisecond
22+
defaultHandshakeTimeout = 1000 * time.Millisecond
2323
defaultResendTimeout = 2000 * time.Millisecond
2424
finSendTimeout = 1000 * time.Millisecond
2525
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)