Skip to content

Commit 672edb2

Browse files
committed
auto merge of #10093 : alexcrichton/rust/issue-8811, r=pcwalton
Closes #8811
2 parents de3d36a + 651f5db commit 672edb2

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

src/libstd/rt/io/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ pub enum IoErrorKind {
368368
Closed,
369369
ConnectionRefused,
370370
ConnectionReset,
371+
ConnectionAborted,
371372
NotConnected,
372373
BrokenPipe,
373374
PathAlreadyExists,
@@ -397,6 +398,7 @@ impl ToStr for IoErrorKind {
397398
MismatchedFileTypeForOperation => ~"MismatchedFileTypeForOperation",
398399
IoUnavailable => ~"IoUnavailable",
399400
ResourceUnavailable => ~"ResourceUnavailable",
401+
ConnectionAborted => ~"ConnectionAborted",
400402
}
401403
}
402404
}

src/libstd/rt/io/net/tcp.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ mod test {
364364
}
365365

366366
#[test]
367-
#[ignore(cfg(windows))] // FIXME #8811
368367
fn write_close_ip4() {
369368
do run_in_mt_newsched_task {
370369
let addr = next_test_ip4();
@@ -380,8 +379,11 @@ mod test {
380379
loop {
381380
let mut stop = false;
382381
do io_error::cond.trap(|e| {
383-
// NB: ECONNRESET on linux, EPIPE on mac
384-
assert!(e.kind == ConnectionReset || e.kind == BrokenPipe);
382+
// NB: ECONNRESET on linux, EPIPE on mac, ECONNABORTED
383+
// on windows
384+
assert!(e.kind == ConnectionReset ||
385+
e.kind == BrokenPipe ||
386+
e.kind == ConnectionAborted);
385387
stop = true;
386388
}).inside {
387389
stream.write(buf);
@@ -399,7 +401,6 @@ mod test {
399401
}
400402

401403
#[test]
402-
#[ignore(cfg(windows))] // FIXME #8811
403404
fn write_close_ip6() {
404405
do run_in_mt_newsched_task {
405406
let addr = next_test_ip6();
@@ -415,8 +416,11 @@ mod test {
415416
loop {
416417
let mut stop = false;
417418
do io_error::cond.trap(|e| {
418-
// NB: ECONNRESET on linux, EPIPE on mac
419-
assert!(e.kind == ConnectionReset || e.kind == BrokenPipe);
419+
// NB: ECONNRESET on linux, EPIPE on mac, ECONNABORTED
420+
// on windows
421+
assert!(e.kind == ConnectionReset ||
422+
e.kind == BrokenPipe ||
423+
e.kind == ConnectionAborted);
420424
stop = true;
421425
}).inside {
422426
stream.write(buf);

src/libstd/rt/uv/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ pub fn uv_error_to_io_error(uverr: UvError) -> IoError {
314314
ECONNRESET => ConnectionReset,
315315
ENOTCONN => NotConnected,
316316
EPIPE => BrokenPipe,
317+
ECONNABORTED => ConnectionAborted,
317318
err => {
318319
rtdebug!("uverr.code {}", err as int);
319320
// XXX: Need to map remaining uv error types

src/libstd/rt/uv/uvll.rs

+2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub mod errors {
5555
pub static ECONNRESET: c_int = -4078;
5656
pub static ENOTCONN: c_int = -4054;
5757
pub static EPIPE: c_int = -4048;
58+
pub static ECONNABORTED: c_int = -4080;
5859
}
5960
#[cfg(not(windows))]
6061
pub mod errors {
@@ -66,6 +67,7 @@ pub mod errors {
6667
pub static ECONNRESET: c_int = -libc::ECONNRESET;
6768
pub static ENOTCONN: c_int = -libc::ENOTCONN;
6869
pub static EPIPE: c_int = -libc::EPIPE;
70+
pub static ECONNABORTED: c_int = -libc::ECONNABORTED;
6971
}
7072

7173
pub static PROCESS_SETUID: c_int = 1 << 0;

0 commit comments

Comments
 (0)