增加日志
This commit is contained in:
@@ -172,7 +172,7 @@ impl IFace for Device {
|
|||||||
|
|
||||||
fn shutdown(&self) -> io::Result<()> {
|
fn shutdown(&self) -> io::Result<()> {
|
||||||
unsafe {
|
unsafe {
|
||||||
if 0 == synchapi::SetEvent(self.shutdown_event) {
|
if winapi::shared::minwindef::TRUE == synchapi::SetEvent(self.shutdown_event) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(io::Error::last_os_error())
|
Err(io::Error::last_os_error())
|
||||||
@@ -284,11 +284,11 @@ impl Device {
|
|||||||
if result == winbase::WAIT_OBJECT_0 {
|
if result == winbase::WAIT_OBJECT_0 {
|
||||||
//We have data!
|
//We have data!
|
||||||
continue;
|
continue;
|
||||||
} else if result == winbase::WAIT_OBJECT_0 + 1 {
|
} else {
|
||||||
//Shutdown event triggered
|
//Shutdown event triggered
|
||||||
return Err(io::Error::new(
|
return Err(io::Error::new(
|
||||||
io::ErrorKind::Other,
|
io::ErrorKind::Other,
|
||||||
"Shutdown event triggered",
|
format!("Shutdown event triggered {}", io::Error::last_os_error()),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,8 +336,8 @@ impl Drop for Device {
|
|||||||
}
|
}
|
||||||
self.win_tun.WintunEndSession(self.session);
|
self.win_tun.WintunEndSession(self.session);
|
||||||
self.win_tun.WintunCloseAdapter(self.adapter);
|
self.win_tun.WintunCloseAdapter(self.adapter);
|
||||||
if 0 != self.win_tun.WintunDeleteDriver() {
|
if winapi::shared::minwindef::FALSE == self.win_tun.WintunDeleteDriver() {
|
||||||
log::warn!("WintunDeleteDriver failed")
|
log::warn!("WintunDeleteDriver failed {:?}", io::Error::last_os_error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user