]> git.lizzy.rs Git - rust.git/commitdiff
Implement another error code found on windows.
authorAlex Crichton <alex@alexcrichton.com>
Sat, 26 Oct 2013 23:04:05 +0000 (16:04 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Sat, 26 Oct 2013 23:04:05 +0000 (16:04 -0700)
Closes #8811

src/libstd/rt/io/mod.rs
src/libstd/rt/io/net/tcp.rs
src/libstd/rt/uv/mod.rs
src/libstd/rt/uv/uvll.rs

index decf801d59294faf174f182b35913b05073a687d..dc69c8486daad774185350af88b1e1bd0656a3ad 100644 (file)
@@ -368,6 +368,7 @@ pub enum IoErrorKind {
     Closed,
     ConnectionRefused,
     ConnectionReset,
+    ConnectionAborted,
     NotConnected,
     BrokenPipe,
     PathAlreadyExists,
@@ -397,6 +398,7 @@ fn to_str(&self) -> ~str {
             MismatchedFileTypeForOperation => ~"MismatchedFileTypeForOperation",
             IoUnavailable => ~"IoUnavailable",
             ResourceUnavailable => ~"ResourceUnavailable",
+            ConnectionAborted => ~"ConnectionAborted",
         }
     }
 }
index 4e841b36a5d3739d22578cb7077a6a09c845450a..6314c0755a0bc40834f66e431ad64746973a73c6 100644 (file)
@@ -364,7 +364,6 @@ fn read_eof_twice_ip6() {
     }
 
     #[test]
-    #[ignore(cfg(windows))] // FIXME #8811
     fn write_close_ip4() {
         do run_in_mt_newsched_task {
             let addr = next_test_ip4();
@@ -380,8 +379,11 @@ fn write_close_ip4() {
                 loop {
                     let mut stop = false;
                     do io_error::cond.trap(|e| {
-                        // NB: ECONNRESET on linux, EPIPE on mac
-                        assert!(e.kind == ConnectionReset || e.kind == BrokenPipe);
+                        // NB: ECONNRESET on linux, EPIPE on mac, ECONNABORTED
+                        //     on windows
+                        assert!(e.kind == ConnectionReset ||
+                                e.kind == BrokenPipe ||
+                                e.kind == ConnectionAborted);
                         stop = true;
                     }).inside {
                         stream.write(buf);
@@ -399,7 +401,6 @@ fn write_close_ip4() {
     }
 
     #[test]
-    #[ignore(cfg(windows))] // FIXME #8811
     fn write_close_ip6() {
         do run_in_mt_newsched_task {
             let addr = next_test_ip6();
@@ -415,8 +416,11 @@ fn write_close_ip6() {
                 loop {
                     let mut stop = false;
                     do io_error::cond.trap(|e| {
-                        // NB: ECONNRESET on linux, EPIPE on mac
-                        assert!(e.kind == ConnectionReset || e.kind == BrokenPipe);
+                        // NB: ECONNRESET on linux, EPIPE on mac, ECONNABORTED
+                        //     on windows
+                        assert!(e.kind == ConnectionReset ||
+                                e.kind == BrokenPipe ||
+                                e.kind == ConnectionAborted);
                         stop = true;
                     }).inside {
                         stream.write(buf);
index c92a54425bf4f2962ee08e4fde04527d93101bcb..b611c6a5c5da0381ed31799c5d128ccd22a2be9b 100644 (file)
@@ -314,6 +314,7 @@ pub fn uv_error_to_io_error(uverr: UvError) -> IoError {
             ECONNRESET => ConnectionReset,
             ENOTCONN => NotConnected,
             EPIPE => BrokenPipe,
+            ECONNABORTED => ConnectionAborted,
             err => {
                 rtdebug!("uverr.code {}", err as int);
                 // XXX: Need to map remaining uv error types
index 18e95c8966e18eb2d7c4de039cf07d8db2f0a984..2964eb9c58be3f4befbe35ec34f5e2794de442aa 100644 (file)
@@ -55,6 +55,7 @@ pub mod errors {
     pub static ECONNRESET: c_int = -4078;
     pub static ENOTCONN: c_int = -4054;
     pub static EPIPE: c_int = -4048;
+    pub static ECONNABORTED: c_int = -4080;
 }
 #[cfg(not(windows))]
 pub mod errors {
@@ -66,6 +67,7 @@ pub mod errors {
     pub static ECONNRESET: c_int = -libc::ECONNRESET;
     pub static ENOTCONN: c_int = -libc::ENOTCONN;
     pub static EPIPE: c_int = -libc::EPIPE;
+    pub static ECONNABORTED: c_int = -libc::ECONNABORTED;
 }
 
 pub static PROCESS_SETUID: c_int = 1 << 0;