Closed ebakoba closed 1 year ago
Patch coverage: 12.50
% and project coverage change: +0.04
:tada:
Comparison is base (
dd4c9bd
) 73.35% compared to head (368a832
) 73.39%.
:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
@jhelovuo Seems like the lint is failing due to problems not related to changes in the PR.
@ebakoba Hi! Do all the unit tests pass on your Windows machine? On my machine the UDP listener/sender unit tests fail, but on the other hand the Shapes-demo works without problems. So I'm just wondering if the unit tests fail because of something related to my machine.
@ohuopio Hi! For me the following tests fail:
I have tracked it to following function in udp_listener.rs
:
// TODO: remove this. It is used only for tests.
// We cannot read a single packet only, because we use edge-triggered polls.
#[cfg(test)]
pub fn get_message(&self) -> Vec<u8> {
let mut message: Vec<u8> = vec![];
let mut buf: [u8; MAX_MESSAGE_SIZE] = [0; MAX_MESSAGE_SIZE];
match self.socket.recv(&mut buf) {
Ok(nbytes) => {
message = buf[..nbytes].to_vec();
return message;
}
Err(e) => {
debug!("UDPListener::get_message failed: {:?}", e);
}
};
message
}
This function always fails on Windows with WouldBlock
error, same way the sending address used to fail. Unfortunately because of MIO dependency in the listening process we cannot just make it use std::UdpSocket
. As the comment mentions this function is only used in tests, thats why the shapes demo works fine. Do you have a suggestion how we could take this further? Could we replace get_message(...)
with something more realistic? Do we have to elevate this issue to mio
?
@ebakoba I'm merging this pull request, since it does fix #249 after all. The 4 unit tests do fail on Windows (as they have failed before), but in the future we'll stop using MIO and start using Rust's standard async features instead. We'll fix the unit tests then.
Thanks for the contribution @ebakoba!
Fixes #249
1) Tried to set
.set_nonblocking(false)
onmio
socket, but this option seemed to not exist. 2) Changed out themio
based socket for thestd
, which seemed to resolve the problem.If I had to guess I think
mio
is setting.set_nonblocking(true)
for some reason in its socket implementation.