Skip to content

Implement another error code found on windows. #10093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 28, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/libstd/rt/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ pub enum IoErrorKind {
Closed,
ConnectionRefused,
ConnectionReset,
ConnectionAborted,
NotConnected,
BrokenPipe,
PathAlreadyExists,
Expand Down Expand Up @@ -397,6 +398,7 @@ impl ToStr for IoErrorKind {
MismatchedFileTypeForOperation => ~"MismatchedFileTypeForOperation",
IoUnavailable => ~"IoUnavailable",
ResourceUnavailable => ~"ResourceUnavailable",
ConnectionAborted => ~"ConnectionAborted",
}
}
}
Expand Down
16 changes: 10 additions & 6 deletions src/libstd/rt/io/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ mod test {
}

#[test]
#[ignore(cfg(windows))] // FIXME #8811
fn write_close_ip4() {
do run_in_mt_newsched_task {
let addr = next_test_ip4();
Expand All @@ -380,8 +379,11 @@ mod test {
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);
Expand All @@ -399,7 +401,6 @@ mod test {
}

#[test]
#[ignore(cfg(windows))] // FIXME #8811
fn write_close_ip6() {
do run_in_mt_newsched_task {
let addr = next_test_ip6();
Expand All @@ -415,8 +416,11 @@ mod test {
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);
Expand Down
1 change: 1 addition & 0 deletions src/libstd/rt/uv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/rt/uv/uvll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down