Commit 5f36e9a3 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

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/30164Reviewed-by: default avatarSam Whited <sam@samwhited.com>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 99339dd4
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment