File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -1892,9 +1892,11 @@ func (st *stream) copyTrailersToHandlerRequest() {
1892
1892
// onReadTimeout is run on its own goroutine (from time.AfterFunc)
1893
1893
// when the stream's ReadTimeout has fired.
1894
1894
func (st * stream ) onReadTimeout () {
1895
- // Wrap the ErrDeadlineExceeded to avoid callers depending on us
1896
- // returning the bare error.
1897
- st .body .CloseWithError (fmt .Errorf ("%w" , os .ErrDeadlineExceeded ))
1895
+ if st .body != nil {
1896
+ // Wrap the ErrDeadlineExceeded to avoid callers depending on us
1897
+ // returning the bare error.
1898
+ st .body .CloseWithError (fmt .Errorf ("%w" , os .ErrDeadlineExceeded ))
1899
+ }
1898
1900
}
1899
1901
1900
1902
// onWriteTimeout is run on its own goroutine (from time.AfterFunc)
@@ -2012,9 +2014,7 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error {
2012
2014
// (in Go 1.8), though. That's a more sane option anyway.
2013
2015
if sc .hs .ReadTimeout != 0 {
2014
2016
sc .conn .SetReadDeadline (time.Time {})
2015
- if st .body != nil {
2016
- st .readDeadline = time .AfterFunc (sc .hs .ReadTimeout , st .onReadTimeout )
2017
- }
2017
+ st .readDeadline = time .AfterFunc (sc .hs .ReadTimeout , st .onReadTimeout )
2018
2018
}
2019
2019
2020
2020
go sc .runHandler (rw , req , handler )
You can’t perform that action at this time.
0 commit comments