add some comments

This commit is contained in:
iamqizhao 2015-05-27 15:45:19 -07:00
parent 1b5f15dda8
commit a1baa00131
2 changed files with 2 additions and 11 deletions

View File

@ -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)
} }

View File

@ -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
}
}