move deadlineTimer declaration out of the Read loop

This commit is contained in:
Marten Seemann 2020-05-04 18:46:51 +07:00
parent 93cee1e07b
commit 996dd42055

View file

@ -104,6 +104,7 @@ func (s *receiveStream) readImpl(p []byte) (bool /*stream completed */, int, err
}
bytesRead := 0
var deadlineTimer *utils.Timer
for bytesRead < len(p) {
if s.currentFrame == nil || s.readPosInFrame >= len(s.currentFrame) {
s.dequeueNextFrame()
@ -112,7 +113,6 @@ func (s *receiveStream) readImpl(p []byte) (bool /*stream completed */, int, err
return false, bytesRead, s.closeForShutdownErr
}
var deadlineTimer *utils.Timer
for {
// Stop waiting on errors
if s.closedForShutdown {