Added error log messages for unreachable conditions
@@ -4,6 +4,7 @@ use super::Event;
use super::SocketState;
use crate::sys::Events;
use crate::{Interests, Token};
+use log::error;
use miow::iocp::{CompletionPort, CompletionStatus};
use miow::Overlapped;
@@ -58,9 +59,16 @@ impl AfdGroup {
self._alloc_afd_group(&mut afd_group)?;
}
}
+
match afd_group.last() {
Some(arc) => Ok(arc.clone()),
- None => unreachable!(),
+ None => {
+ error!(
+ "Cannot acquire afd, {:#?}, afd_group: {:#?}",
+ self, afd_group
+ );
+ unreachable!()
+ }
}
}
@@ -188,6 +196,7 @@ impl SockState {
self.poll_status = SockPollStatus::Pending;
self.pending_evts = self.user_evts;
} else {
+ error!("Invalid poll status during update, {:#?}", self);
unreachable!();
}
Ok(())
@@ -196,7 +205,10 @@ impl SockState {
fn cancel(&mut self) -> io::Result<()> {
match self.poll_status {
SockPollStatus::Pending => {}
- _ => unreachable!(),
+ _ => {
+ error!("Invalid poll status during cancel, {:#?}", self);
+ unreachable!()
+ }
};
unsafe {
self.afd.cancel(&mut *self.iosb)?;
