std::rt: Ignore 0-byte udp reads
This commit is contained in:
parent
6fb92f8cab
commit
413d51e32d
1 changed files with 7 additions and 0 deletions
|
@ -392,6 +392,13 @@ impl UdpWatcher {
|
||||||
|
|
||||||
extern fn recv_cb(handle: *uvll::uv_udp_t, nread: ssize_t, buf: Buf,
|
extern fn recv_cb(handle: *uvll::uv_udp_t, nread: ssize_t, buf: Buf,
|
||||||
addr: *uvll::sockaddr, flags: c_uint) {
|
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 addr: %x", buf.base as uint);
|
||||||
rtdebug!("buf len: %d", buf.len as int);
|
rtdebug!("buf len: %d", buf.len as int);
|
||||||
let mut udp_watcher: UdpWatcher = NativeHandle::from_native_handle(handle);
|
let mut udp_watcher: UdpWatcher = NativeHandle::from_native_handle(handle);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue