rust-utp icon indicating copy to clipboard operation
rust-utp copied to clipboard

CloneableSocket recv() not understanding closed connections

Open ned14 opened this issue 9 years ago • 5 comments

I am calling close() on a CloneableSocket but it does not appear to cause reads in the other side CloneableSocket to exit with an Err. This is because CloneableSocket's recv() is missing the same closed connection detection logic as UtpSocket's recv_form().

The other thing we need is to detect ungraceful connection close. Either a heartbeat, or a timeout since last packet received would work.

ned14 avatar Jun 18 '15 16:06 ned14

It should be fixed on e7d6cdb.

The other thing we need is to detect ungraceful connection close. Either a heartbeat, or a timeout since last packet received would work.

I'm aware of that. I used to have timeout detection working before the Rust reforms that removed the set_read_timeout method on UdpSocket. :disappointed:

meqif avatar Jun 18 '15 17:06 meqif

[...] before the Rust reforms that removed the set_read_timeout method on UdpSocket. :disappointed:

It's back.

vinipsmaker avatar Jul 29 '15 13:07 vinipsmaker

It has been available as an unstable feature for a while. Unfortunately we can't depend on it because the library must be compatible with stable rust.

The ability to set timeouts has been reimplemented in the with_read_timeout subcrate, and the latest master is using it to detect timeouts. When a new version is published, I'll close this issue.

meqif avatar Jul 29 '15 15:07 meqif

The ability to set timeouts has been reimplemented in the with_read_timeout subcrate, and the latest master is using it to detect timeouts. When a new version is published, I'll close this issue.

I see there is no way for myself to use timeouts at every request. I'll write some code and send a PR.

vinipsmaker avatar Jul 31 '15 17:07 vinipsmaker

I see there is no way for myself to use timeouts at every request. I'll write some code and send a PR.

Just dropping a link to the PR: https://github.com/meqif/rust-utp/pull/10

vinipsmaker avatar Aug 20 '15 15:08 vinipsmaker