From: miller Date: Thu, 18 May 2023 09:17:42 +0000 (+0100) Subject: internal/poll: handle SetDeadline to time.Now() in Plan 9 X-Git-Tag: go1.21rc1~418 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=86c6b4763ed486f20cf018d0810cfd7a1fd91998;p=gostls13.git internal/poll: handle SetDeadline to time.Now() in Plan 9 The implementation of SetDeadline in Plan 9 begins by calculating d = the offset of the requested deadline from time.Now(). If d > 0, a timer is set to interrupt future I/O. If d < 0, the channel is flagged to prevent future I/O and any current I/O is cancelled. But if d = 0, nothing happens and the deadline isn't set. The d = 0 case should be handled the same as d < 0. Fixes #60282 Fixes #52896 Change-Id: Id8167db3604db1c129d99376fa78a3da75417d20 Reviewed-on: https://go-review.googlesource.com/c/go/+/496137 Reviewed-by: Bryan Mills TryBot-Result: Gopher Robot Run-TryBot: Bryan Mills Reviewed-by: David du Colombier <0intro@gmail.com> Auto-Submit: Bryan Mills Reviewed-by: Ian Lance Taylor --- diff --git a/src/internal/poll/fd_plan9.go b/src/internal/poll/fd_plan9.go index 2cfc5eec26..7cc178a9d5 100644 --- a/src/internal/poll/fd_plan9.go +++ b/src/internal/poll/fd_plan9.go @@ -171,7 +171,7 @@ func setDeadlineImpl(fd *FD, t time.Time, mode int) error { fd.wtimer = timer } } - if !t.IsZero() && d < 0 { + if !t.IsZero() && d <= 0 { // Interrupt current I/O operation if mode == 'r' || mode == 'r'+'w' { fd.rtimedout = true