const inflowMinRefresh … type inflow … // init sets the initial window. func (f *inflow) init(n int32) { … } // add adds n bytes to the window, with a maximum window size of max, // indicating that the peer can now send us more data. // For example, the user read from a {Request,Response} body and consumed // some of the buffered data, so the peer can now send more. // It returns the number of bytes to send in a WINDOW_UPDATE frame to the peer. // Window updates are accumulated and sent when the unsent capacity // is at least inflowMinRefresh or will at least double the peer's available window. func (f *inflow) add(n int) (connAdd int32) { … } // take attempts to take n bytes from the peer's flow control window. // It reports whether the window has available capacity. func (f *inflow) take(n uint32) bool { … } // takeInflows attempts to take n bytes from two inflows, // typically connection-level and stream-level flows. // It reports whether both windows have available capacity. func takeInflows(f1, f2 *inflow, n uint32) bool { … } type outflow … func (f *outflow) setConnFlow(cf *outflow) { … } func (f *outflow) available() int32 { … } func (f *outflow) 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 *outflow) add(n int32) bool { … }