Don't ignore duplicate AsyncFd registrations when the type is different
diff --git a/src/sfos/tokio_qt.rs b/src/sfos/tokio_qt.rs
index 83a70e6..b8c2bfa 100644
--- a/src/sfos/tokio_qt.rs
+++ b/src/sfos/tokio_qt.rs
@@ -158,9 +158,14 @@ impl TokioQEventDispatcherPriv {
std::thread::current().id()
);
- let reg = AsyncFd::with_interest(fd, notifier.notifier_type().into()).unwrap(); // XXX unwrap
-
- self.socket_registrations().push((raw_notifier, reg));
+ match AsyncFd::with_interest(fd, notifier.notifier_type().into()) {
+ Ok(reg) => self.socket_registrations().push((raw_notifier, reg)),
+ Err(e) => match e.kind() {
+ _ => {
+ log::error!("Could not register Fd: {}", e);
+ }
+ },
+ };
}
Ignoring these duplicate registrations resolves problems like #158 (closed), but it's not 100% correct.
Edited by Ruben De Smet