websockets-rs / rust-websocket

A WebSocket (RFC6455) library written in Rust
http://websockets-rs.github.io/rust-websocket/
MIT License
1.55k stars 223 forks source link

WebSocketError:NoDataAvailable incomplete #152

Closed ParadoxSpiral closed 5 years ago

ParadoxSpiral commented 6 years ago

It does not get thrown on a non-blocking stream that errs with libc::EAGAIN, instead this error occurs: WebSocketError::IoError(err) with err.raw_os_error() == Some(libc::EAGAIN).

illegalprime commented 6 years ago

You're right, here's the line: https://github.com/cyderize/rust-websocket/blob/master/src/result.rs#L112

Do you have a test case to reproduce this with?

ParadoxSpiral commented 6 years ago

Yes, sorry for the late reply, didn't get an e-mail.

The stream is set to non-blocking here, the message handling is this.

If you remove the match, the thread will spinn at 100%. (Note: to run this, cargo run this, and in the axon UI enter 127.0.0.1 and hit enter)

EDIT: (Note that the links are broken since I switched to the async client)

illegalprime commented 6 years ago

Thanks for the info! I'll check it out, I'm finally done with exams.

ParadoxSpiral commented 5 years ago

Closing due to inactivity and that I use tungstenite instead of this crate. May as well be solved since this is quite old and no new reports of this.