Skip to content

Commit

Permalink
gbn: increase defaultHandshakeTimeout to 1 second
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ViktorTigerstrom committed Nov 10, 2023
1 parent 6a938aa commit b033f3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gbn/gbn_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var (

const (
DefaultN = 20
defaultHandshakeTimeout = 100 * time.Millisecond
defaultHandshakeTimeout = 1000 * time.Millisecond
defaultResendTimeout = 2000 * time.Millisecond
finSendTimeout = 1000 * time.Millisecond
defaultResendMultiplier = 5
Expand Down
5 changes: 4 additions & 1 deletion gbn/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit b033f3d

Please sign in to comment.