Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
Tweak flow queue for higher bandwidth
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Dec 20, 2021
1 parent e9d0a42 commit 5c292d2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions terminal/flow_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
)

const (
DefaultQueueSize = 1000
MaxQueueSize = 1000
forceReportFraction = 4
DefaultQueueSize = 1000
MaxQueueSize = 10000
forceReportBelowPercent = 0.75
)

type DuplexFlowQueue struct {
Expand Down Expand Up @@ -74,13 +74,13 @@ func NewDuplexFlowQueue(

// shouldReportRecvSpace returns whether the receive space should be reported.
func (dfq *DuplexFlowQueue) shouldReportRecvSpace() bool {
return atomic.LoadInt32(dfq.reportedSpace) < int32(cap(dfq.recvQueue)/forceReportFraction)
return atomic.LoadInt32(dfq.reportedSpace) < int32(float32(cap(dfq.recvQueue))*forceReportBelowPercent)
}

// decrementReportedRecvSpace decreases the reported recv space by 1 and
// returns if the receive space should be reported.
func (dfq *DuplexFlowQueue) decrementReportedRecvSpace() (shouldReportRecvSpace bool) {
return atomic.AddInt32(dfq.reportedSpace, -1) < int32(cap(dfq.recvQueue)/forceReportFraction)
return atomic.AddInt32(dfq.reportedSpace, -1) < int32(float32(cap(dfq.recvQueue))*forceReportBelowPercent)
}

// getSendSpace returns the current send space.
Expand Down

0 comments on commit 5c292d2

Please sign in to comment.