]> Cypherpunks repositories - gostls13.git/commitdiff
net: clarify that Conn deadlines also affect currently-blocked I/O
authorBrad Fitzpatrick <bradfitz@golang.org>
Sun, 2 Oct 2016 03:28:09 +0000 (20:28 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 3 Oct 2016 17:47:08 +0000 (17:47 +0000)
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 <sam@samwhited.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/net/net.go

index 8ab952ae72b7846dd28194d07458dbe5cdfd8dd0..6198d94a14db21644d6028fdd54005a69b1ccde0 100644 (file)
@@ -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.