Use user context instead of creating new context for client side stream
This commit is contained in:
@ -252,8 +252,7 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream {
|
|||||||
s.windowHandler = func(n int) {
|
s.windowHandler = func(n int) {
|
||||||
t.updateWindow(s, uint32(n))
|
t.updateWindow(s, uint32(n))
|
||||||
}
|
}
|
||||||
// Make a stream be able to cancel the pending operations by itself.
|
s.ctx = ctx
|
||||||
s.ctx, s.cancel = context.WithCancel(ctx)
|
|
||||||
s.dec = &recvBufferReader{
|
s.dec = &recvBufferReader{
|
||||||
ctx: s.ctx,
|
ctx: s.ctx,
|
||||||
goAway: s.goAway,
|
goAway: s.goAway,
|
||||||
|
@ -170,6 +170,7 @@ type Stream struct {
|
|||||||
st ServerTransport
|
st ServerTransport
|
||||||
// ctx is the associated context of the stream.
|
// ctx is the associated context of the stream.
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
|
// cancel is always nil for client side Stream.
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
// done is closed when the final status arrives.
|
// done is closed when the final status arrives.
|
||||||
done chan struct{}
|
done chan struct{}
|
||||||
|
Reference in New Issue
Block a user