zeromq / zmq.rs

A native implementation of ØMQ in Rust
https://crates.io/crates/zeromq
MIT License
1.13k stars 94 forks source link

Handle errors in Pull and Router #150

Closed njeisecke closed 2 years ago

njeisecke commented 2 years ago

ConnectionReset is a common error that occurs here.

Invoking peer_disconnected regardless of the error might be a little coarse but that should be better than raising a panic.

njeisecke commented 2 years ago

Seems this is not enough.

Could it be that GenericSocketBackend::peer_disconnect must also remove the peer from fair_queue?

njeisecke commented 2 years ago

@Alexei-Kornienko, could you please confirm (or deny) this being the proper way to handle errors? Thanks.

Alexei-Kornienko commented 2 years ago

Mostly LGTM. I guess we can merge this. Could you please remove dbg! from the code? I think that we should use some other way to log error instead of just writing it to stderr (maybe use tracing crate?).

njeisecke commented 2 years ago

Thanks for reviewing. I think using the tracing crate would be a good idea so that the application can decide how to log this. For now I've removed the dbg!.