Skip to content

Commit d951da8

Browse files
committed
core::rt: Fix TCP test on mac
1 parent 2bc1e6b commit d951da8

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

src/libcore/rt/io/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ pub enum IoErrorKind {
348348
ConnectionFailed,
349349
Closed,
350350
ConnectionRefused,
351-
ConnectionReset
351+
ConnectionReset,
352+
BrokenPipe
352353
}
353354

354355
// XXX: Can't put doc comments on macros

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ mod test {
233233
loop {
234234
let mut stop = false;
235235
do io_error::cond.trap(|e| {
236-
assert!(e.kind == ConnectionReset);
236+
// NB: ECONNRESET on linux, EPIPE on mac
237+
assert!(e.kind == ConnectionReset || e.kind == BrokenPipe);
237238
stop = true;
238239
}).in {
239240
stream.write(buf);

src/libcore/rt/uv/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ pub fn uv_error_to_io_error(uverr: UvError) -> IoError {
272272
EACCES => PermissionDenied,
273273
ECONNREFUSED => ConnectionRefused,
274274
ECONNRESET => ConnectionReset,
275-
_ => {
275+
EPIPE => BrokenPipe,
276+
e => {
277+
rtdebug!("e %u", e as uint);
276278
// XXX: Need to map remaining uv error types
277279
OtherIoError
278280
}

src/libcore/rt/uv/uvll.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pub static EADDRINFO: c_int = 2;
4040
pub static EACCES: c_int = 3;
4141
pub static ECONNREFUSED: c_int = 12;
4242
pub static ECONNRESET: c_int = 13;
43+
pub static EPIPE: c_int = 36;
4344

4445
pub struct uv_err_t {
4546
code: c_int,

0 commit comments

Comments
 (0)