Skip to content

Commit 5f36e9a

Browse files
committed
net: clarify that Conn deadlines also affect currently-blocked I/O
All implementations have always implemented this behavior, it's tested, and it's depended on by other packages. (notably, by net/http) The one exception is Plan 9 which doesn't support I/O deadlines at all (tracked in #11932). As a result, a bunch of tests fail on plan9 (#7237). But once Plan 9 adds I/O deadline support, it'll also need this behavior. Change-Id: Idb71767f0c99279c66dce29f7bdc78ef467e47aa Reviewed-on: https://go-review.googlesource.com/30164 Reviewed-by: Sam Whited <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 99339dd commit 5f36e9a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/net/net.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,23 @@ type Conn interface {
137137
//
138138
// A deadline is an absolute time after which I/O operations
139139
// fail with a timeout (see type Error) instead of
140-
// blocking. The deadline applies to all future I/O, not just
141-
// the immediately following call to Read or Write.
140+
// blocking. The deadline applies to all future and pending
141+
// I/O, not just the immediately following call to Read or
142+
// Write.
142143
//
143144
// An idle timeout can be implemented by repeatedly extending
144145
// the deadline after successful Read or Write calls.
145146
//
146147
// A zero value for t means I/O operations will not time out.
147148
SetDeadline(t time.Time) error
148149

149-
// SetReadDeadline sets the deadline for future Read calls.
150+
// SetReadDeadline sets the deadline for future Read calls
151+
// and any currently-blocked Read call.
150152
// A zero value for t means Read will not time out.
151153
SetReadDeadline(t time.Time) error
152154

153-
// SetWriteDeadline sets the deadline for future Write calls.
155+
// SetWriteDeadline sets the deadline for future Write calls
156+
// and any currently-blocked Write call.
154157
// Even if write times out, it may return n > 0, indicating that
155158
// some of the data was successfully written.
156159
// A zero value for t means Write will not time out.

0 commit comments

Comments
 (0)