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 @@ -1900,9 +1900,11 @@ func (st *stream) copyTrailersToHandlerRequest() {
1900
1900
// onReadTimeout is run on its own goroutine (from time.AfterFunc)
1901
1901
// when the stream's ReadTimeout has fired.
1902
1902
func (st * stream ) onReadTimeout () {
1903
- // Wrap the ErrDeadlineExceeded to avoid callers depending on us
1904
- // returning the bare error.
1905
- st .body .CloseWithError (fmt .Errorf ("%w" , os .ErrDeadlineExceeded ))
1903
+ if st .body != nil {
1904
+ // Wrap the ErrDeadlineExceeded to avoid callers depending on us
1905
+ // returning the bare error.
1906
+ st .body .CloseWithError (fmt .Errorf ("%w" , os .ErrDeadlineExceeded ))
1907
+ }
1906
1908
}
1907
1909
1908
1910
// onWriteTimeout is run on its own goroutine (from time.AfterFunc)
@@ -2020,9 +2022,7 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error {
2020
2022
// (in Go 1.8), though. That's a more sane option anyway.
2021
2023
if sc .hs .ReadTimeout != 0 {
2022
2024
sc .conn .SetReadDeadline (time.Time {})
2023
- if st .body != nil {
2024
- st .readDeadline = time .AfterFunc (sc .hs .ReadTimeout , st .onReadTimeout )
2025
- }
2025
+ st .readDeadline = time .AfterFunc (sc .hs .ReadTimeout , st .onReadTimeout )
2026
2026
}
2027
2027
2028
2028
go sc .runHandler (rw , req , handler )
You can’t perform that action at this time.
0 commit comments