Skip to content

Commit

Permalink
check if deadline timer has been cancelled before signaling
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt committed Dec 2, 2023
1 parent c08b7f4 commit d0467a8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d0467a8

Please sign in to comment.