From: Brad Fitzpatrick Date: Sun, 2 Oct 2016 03:28:09 +0000 (-0700) Subject: net: clarify that Conn deadlines also affect currently-blocked I/O X-Git-Tag: go1.8beta1~1075 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5f36e9a3062c1f133169d01d612da9458a7ea884;p=gostls13.git 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 Reviewed-by: Ian Lance Taylor --- diff --git a/src/net/net.go b/src/net/net.go index 8ab952ae72..6198d94a14 100644 --- a/src/net/net.go +++ b/src/net/net.go @@ -137,8 +137,9 @@ type Conn interface { // // A deadline is an absolute time after which I/O operations // fail with a timeout (see type Error) instead of - // blocking. The deadline applies to all future I/O, not just - // the immediately following call to Read or Write. + // blocking. The deadline applies to all future and pending + // I/O, not just the immediately following call to Read or + // Write. // // An idle timeout can be implemented by repeatedly extending // the deadline after successful Read or Write calls. @@ -146,11 +147,13 @@ type Conn interface { // A zero value for t means I/O operations will not time out. SetDeadline(t time.Time) error - // SetReadDeadline sets the deadline for future Read calls. + // SetReadDeadline sets the deadline for future Read calls + // and any currently-blocked Read call. // A zero value for t means Read will not time out. SetReadDeadline(t time.Time) error - // SetWriteDeadline sets the deadline for future Write calls. + // SetWriteDeadline sets the deadline for future Write calls + // and any currently-blocked Write call. // Even if write times out, it may return n > 0, indicating that // some of the data was successfully written. // A zero value for t means Write will not time out.