@ -156,7 +156,7 @@ func (t *http2Server) operateHeaders(hDec *hpackDecoder, s *Stream, frame header
|
||||
s.windowHandler = func(n int) {
|
||||
t.addRecvQuota(s, n)
|
||||
}
|
||||
if hDec.state.timeout > 0 {
|
||||
if hDec.state.timeoutSet {
|
||||
s.ctx, s.cancel = context.WithTimeout(context.TODO(), hDec.state.timeout)
|
||||
} else {
|
||||
s.ctx, s.cancel = context.WithCancel(context.TODO())
|
||||
@ -426,6 +426,7 @@ func (t *http2Server) WriteStatus(s *Stream, statusCode codes.Code, statusDesc s
|
||||
}
|
||||
s.mu.RUnlock()
|
||||
if _, err := wait(s.ctx, t.shutdownChan, t.writableChan); err != nil {
|
||||
// TODO(zhaoq): Print some errors using glog, e.g., glog.V(1).
|
||||
return err
|
||||
}
|
||||
t.hBuf.Reset()
|
||||
|
@ -87,8 +87,9 @@ type decodeState struct {
|
||||
statusCode codes.Code
|
||||
statusDesc string
|
||||
// Server side only fields.
|
||||
timeout time.Duration
|
||||
method string
|
||||
timeoutSet bool
|
||||
timeout time.Duration
|
||||
method string
|
||||
// key-value metadata map from the peer.
|
||||
mdata map[string]string
|
||||
}
|
||||
@ -144,6 +145,7 @@ func newHPACKDecoder() *hpackDecoder {
|
||||
case "grpc-message":
|
||||
d.state.statusDesc = f.Value
|
||||
case "grpc-timeout":
|
||||
d.state.timeoutSet = true
|
||||
var err error
|
||||
d.state.timeout, err = timeoutDecode(f.Value)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user