diff options
author | Russ Cox <rsc@golang.org> | 2010-04-26 22:15:25 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-04-26 22:15:25 -0700 |
commit | 0415bdc67536a8d8c51aa26f2cd9b9cdf2d3967b (patch) | |
tree | 94fb674d518e226f245ba078f44ace74057cd03b /src/pkg/net/timeout_test.go | |
parent | c421356f6cd0b1ae24e49a697f4f135f11a0179a (diff) | |
download | golang-0415bdc67536a8d8c51aa26f2cd9b9cdf2d3967b.tar.gz |
net: introduce net.Error interface
Adds two more methods, Timeout and Temporary.
Implemented by os.Errno too. The intent is to make
the checks for os.EAGAIN a little less clunky.
It should also let us clean up a bug that Mike Solomon
pointed out: if a network server gets an "out of file descriptors"
error from Accept, the listener should not stop.
It will be able to check this because that error would
have Temporary() == true.
Also clean up some underscore names.
Fixes issue 442.
R=r
CC=golang-dev, msolo
http://codereview.appspot.com/957045
Diffstat (limited to 'src/pkg/net/timeout_test.go')
-rw-r--r-- | src/pkg/net/timeout_test.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/net/timeout_test.go b/src/pkg/net/timeout_test.go index be36bcb41..9a7a2685e 100644 --- a/src/pkg/net/timeout_test.go +++ b/src/pkg/net/timeout_test.go @@ -32,8 +32,8 @@ func testTimeout(t *testing.T, network, addr string, readFrom bool) { if readFrom { what = "ReadFrom" } - if n != 0 || !isEAGAIN(err1) { - t.Errorf("fd.%s on %s %s did not return 0, EAGAIN: %v, %v", what, network, addr, n, err1) + if n != 0 || err1 == nil || !err1.(Error).Timeout() { + t.Errorf("fd.%s on %s %s did not return 0, timeout: %v, %v", what, network, addr, n, err1) } if t1-t0 < 0.5e8 || t1-t0 > 1.5e8 { t.Errorf("fd.%s on %s %s took %f seconds, expected 0.1", what, network, addr, float64(t1-t0)/1e9) |