about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-05-14 21:18:47 -0700
committerBrian Anderson <banderson@mozilla.com>2013-05-15 12:19:17 -0700
commitd951da82768685cacba7444dae10ede2a71efedb (patch)
tree850741f6ac4aed5cb1e098b695b62ac1d81ee419 /src/libcore
parent2bc1e6ba606e3f08a49bbadc556558cb42b7ea32 (diff)
downloadrust-d951da82768685cacba7444dae10ede2a71efedb.tar.gz
rust-d951da82768685cacba7444dae10ede2a71efedb.zip
core::rt: Fix TCP test on mac
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/rt/io/mod.rs3
-rw-r--r--src/libcore/rt/io/net/tcp.rs3
-rw-r--r--src/libcore/rt/uv/mod.rs4
-rw-r--r--src/libcore/rt/uv/uvll.rs1
4 files changed, 8 insertions, 3 deletions
diff --git a/src/libcore/rt/io/mod.rs b/src/libcore/rt/io/mod.rs
index 14784fa9567..802e069a738 100644
--- a/src/libcore/rt/io/mod.rs
+++ b/src/libcore/rt/io/mod.rs
@@ -348,7 +348,8 @@ pub enum IoErrorKind {
     ConnectionFailed,
     Closed,
     ConnectionRefused,
-    ConnectionReset
+    ConnectionReset,
+    BrokenPipe
 }
 
 // XXX: Can't put doc comments on macros
diff --git a/src/libcore/rt/io/net/tcp.rs b/src/libcore/rt/io/net/tcp.rs
index 04f4edd7e39..eec3614d129 100644
--- a/src/libcore/rt/io/net/tcp.rs
+++ b/src/libcore/rt/io/net/tcp.rs
@@ -233,7 +233,8 @@ mod test {
                 loop {
                     let mut stop = false;
                     do io_error::cond.trap(|e| {
-                        assert!(e.kind == ConnectionReset);
+                        // NB: ECONNRESET on linux, EPIPE on mac
+                        assert!(e.kind == ConnectionReset || e.kind == BrokenPipe);
                         stop = true;
                     }).in {
                         stream.write(buf);
diff --git a/src/libcore/rt/uv/mod.rs b/src/libcore/rt/uv/mod.rs
index ee3c5ceffd2..93cafb83588 100644
--- a/src/libcore/rt/uv/mod.rs
+++ b/src/libcore/rt/uv/mod.rs
@@ -272,7 +272,9 @@ pub fn uv_error_to_io_error(uverr: UvError) -> IoError {
             EACCES => PermissionDenied,
             ECONNREFUSED => ConnectionRefused,
             ECONNRESET => ConnectionReset,
-            _ => {
+            EPIPE => BrokenPipe,
+            e => {
+                rtdebug!("e %u", e as uint);
                 // XXX: Need to map remaining uv error types
                 OtherIoError
             }
diff --git a/src/libcore/rt/uv/uvll.rs b/src/libcore/rt/uv/uvll.rs
index 94e6b82ab8f..02659ab1eb9 100644
--- a/src/libcore/rt/uv/uvll.rs
+++ b/src/libcore/rt/uv/uvll.rs
@@ -40,6 +40,7 @@ pub static EADDRINFO: c_int = 2;
 pub static EACCES: c_int = 3;
 pub static ECONNREFUSED: c_int = 12;
 pub static ECONNRESET: c_int = 13;
+pub static EPIPE: c_int = 36;
 
 pub struct uv_err_t {
     code: c_int,