Skip to content

Commit

Permalink
std::rt: Ignore 0-byte udp reads
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Jul 9, 2013
1 parent 6fb92f8 commit 413d51e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libstd/rt/uv/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,13 @@ impl UdpWatcher {

extern fn recv_cb(handle: *uvll::uv_udp_t, nread: ssize_t, buf: Buf,
addr: *uvll::sockaddr, flags: c_uint) {
// When there's no data to read the recv callback can be a no-op.
// This can happen if read returns EAGAIN/EWOULDBLOCK. By ignoring
// this we just drop back to kqueue and wait for the next callback.
if nread == 0 {
return;
}

rtdebug!("buf addr: %x", buf.base as uint);
rtdebug!("buf len: %d", buf.len as int);
let mut udp_watcher: UdpWatcher = NativeHandle::from_native_handle(handle);
Expand Down

5 comments on commit 413d51e

@bors
Copy link
Contributor

@bors bors commented on 413d51e Jul 10, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at brson@413d51e

@bors
Copy link
Contributor

@bors bors commented on 413d51e Jul 10, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging brson/rust/io-upstream = 413d51e into auto

@bors
Copy link
Contributor

@bors bors commented on 413d51e Jul 10, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brson/rust/io-upstream = 413d51e merged ok, testing candidate = 41dcec2

@bors
Copy link
Contributor

@bors bors commented on 413d51e Jul 10, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 41dcec2

Please sign in to comment.