mirror of https://github.com/grpc/grpc-go.git
add some comments
This commit is contained in:
parent
1b5f15dda8
commit
a1baa00131
|
|
@ -79,6 +79,7 @@ type http2Client struct {
|
||||||
fc *inFlow
|
fc *inFlow
|
||||||
// sendQuotaPool provides flow control to outbound message.
|
// sendQuotaPool provides flow control to outbound message.
|
||||||
sendQuotaPool *quotaPool
|
sendQuotaPool *quotaPool
|
||||||
|
// streamsQuota limits the max number of concurrent streams.
|
||||||
streamsQuota *quotaPool
|
streamsQuota *quotaPool
|
||||||
|
|
||||||
// The scheme used: https if TLS is on, http otherwise.
|
// 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()
|
t.mu.Unlock()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// Returns the quota balance back.
|
||||||
if q > 1 {
|
if q > 1 {
|
||||||
t.streamsQuota.add(q-1)
|
t.streamsQuota.add(q-1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -451,14 +451,3 @@ func wait(ctx context.Context, closing <-chan struct{}, proceed <-chan int) (int
|
||||||
return i, nil
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue