core::rt: Fix TCP test on mac

This commit is contained in:
Brian Anderson 2013-05-14 21:18:47 -07:00
parent 2bc1e6ba60
commit d951da8276
4 changed files with 8 additions and 3 deletions

View file

@ -348,7 +348,8 @@ pub enum IoErrorKind {
ConnectionFailed,
Closed,
ConnectionRefused,
ConnectionReset
ConnectionReset,
BrokenPipe
}
// XXX: Can't put doc comments on macros

View file

@ -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);

View file

@ -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
}

View file

@ -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,