Copyright 2014 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Flow control

package http2
flow is the flow control window's size.
type flow struct {
	_ incomparable
n is the number of DATA bytes we're allowed to send. A flow is kept both on a conn and a per-stream.
conn points to the shared connection-level flow that is shared by all streams on that conn. It is nil for the flow that's on the conn directly.
	conn *flow
}

func ( *flow) ( *flow) { .conn =  }

func ( *flow) () int32 {
	 := .n
	if .conn != nil && .conn.n <  {
		 = .conn.n
	}
	return 
}

func ( *flow) ( int32) {
	if  > .available() {
		panic("internal error: took too much")
	}
	.n -= 
	if .conn != nil {
		.conn.n -= 
	}
}
add adds n bytes (positive or negative) to the flow control window. It returns false if the sum would exceed 2^31-1.
func ( *flow) ( int32) bool {
	 := .n + 
	if ( > ) == (.n > 0) {
		.n = 
		return true
	}
	return false