diff --git a/transport/http2_client.go b/transport/http2_client.go index 1420b1668..00a167209 100644 --- a/transport/http2_client.go +++ b/transport/http2_client.go @@ -79,6 +79,7 @@ type http2Client struct { fc *inFlow // sendQuotaPool provides flow control to outbound message. sendQuotaPool *quotaPool + // streamsQuota limits the max number of concurrent streams. streamsQuota *quotaPool // The scheme used: https if TLS is on, http otherwise. @@ -248,6 +249,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea t.mu.Unlock() return nil, err } + // Returns the quota balance back. if q > 1 { t.streamsQuota.add(q-1) } diff --git a/transport/transport.go b/transport/transport.go index 052f2618e..5dfd89f0d 100644 --- a/transport/transport.go +++ b/transport/transport.go @@ -451,14 +451,3 @@ func wait(ctx context.Context, closing <-chan struct{}, proceed <-chan int) (int return i, nil } } - -func wait64(ctx context.Context, closing <-chan struct{}, proceed <-chan int64) (int64, error) { - select { - case <-ctx.Done(): - return 0, ContextErr(ctx.Err()) - case <-closing: - return 0, ErrConnClosing - case i := <-proceed: - return i, nil - } -}