diff options
Diffstat (limited to 'vendor/golang.org/x/net/http2/flow.go')
-rw-r--r-- | vendor/golang.org/x/net/http2/flow.go | 10 |
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 957de25..cea601f 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) { | |||
41 | // add adds n bytes (positive or negative) to the flow control window. | 41 | // add adds n bytes (positive or negative) to the flow control window. |
42 | // It returns false if the sum would exceed 2^31-1. | 42 | // It returns false if the sum would exceed 2^31-1. |
43 | func (f *flow) add(n int32) bool { | 43 | func (f *flow) add(n int32) bool { |
44 | remain := (1<<31 - 1) - f.n | 44 | sum := f.n + n |
45 | if n > remain { | 45 | if (sum > n) == (f.n > 0) { |
46 | return false | 46 | f.n = sum |
47 | return true | ||
47 | } | 48 | } |
48 | f.n += n | 49 | return false |
49 | return true | ||
50 | } | 50 | } |