From 9a49609db82f211220caa2820672ea0a741e8ed0 Mon Sep 17 00:00:00 2001 From: sukun Date: Sat, 2 Dec 2023 20:18:00 +0530 Subject: [PATCH] Check deadline timer before signaling --- stream.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stream.go b/stream.go index b12bb24c..eeb585e7 100644 --- a/stream.go +++ b/stream.go @@ -175,6 +175,11 @@ func (s *Stream) SetReadDeadline(deadline time.Time) error { t.Stop() return case <-t.C: + select { + case <-readTimeoutCancel: + return + default: + } s.lock.Lock() if s.readErr == nil { s.readErr = ErrReadDeadlineExceeded