summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/net/http2/flow.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-07-22 20:14:05 -0700
committerGitHub <noreply@github.com>2018-07-22 20:14:05 -0700
commitbac3376278bfd8125879ca86e8eb26df85858d4c (patch)
tree8dec71c9deadf8c2138998a3cb6e93b3fec1c380 /vendor/golang.org/x/net/http2/flow.go
parent3539a9a60b24bd9c0c1360b17c8fe3e6ebf8cf3c (diff)
downloadchat-bac3376278bfd8125879ca86e8eb26df85858d4c.tar.gz
chat-bac3376278bfd8125879ca86e8eb26df85858d4c.tar.bz2
chat-bac3376278bfd8125879ca86e8eb26df85858d4c.zip
Updating dependencies (#9139)
Diffstat (limited to 'vendor/golang.org/x/net/http2/flow.go')
-rw-r--r--vendor/golang.org/x/net/http2/flow.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/vendor/golang.org/x/net/http2/flow.go b/vendor/golang.org/x/net/http2/flow.go
index 957de2542..cea601fcd 100644
--- a/vendor/golang.org/x/net/http2/flow.go
+++ b/vendor/golang.org/x/net/http2/flow.go
@@ -41,10 +41,10 @@ func (f *flow) take(n int32) {
// add adds n bytes (positive or negative) to the flow control window.
// It returns false if the sum would exceed 2^31-1.
func (f *flow) add(n int32) bool {
- remain := (1<<31 - 1) - f.n
- if n > remain {
- return false
+ sum := f.n + n
+ if (sum > n) == (f.n > 0) {
+ f.n = sum
+ return true
}
- f.n += n
- return true
+ return false
}