]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/golang.org/x/net/http2/flow.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / golang.org / x / net / http2 / flow.go
index 957de25420d91798efe32d86e82b3c4a1f2bc6f6..cea601fcdf474dce821ea400c0ef1e923bbf8e90 100644 (file)
@@ -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
 }