Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Nov 26, 2024
1 parent 6f77a0e commit 47cfb40
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions net-tools/netwatch/src/netmon/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ impl CallbackHandler {
&mut handle,
);
if r.is_err() {
return Err(anyhow::anyhow!("NotifyUnicastIpAddressChange failed: {:?}", r));
return Err(anyhow::anyhow!(
"NotifyUnicastIpAddressChange failed: {:?}",
r
));
}
}

Expand All @@ -122,9 +125,14 @@ impl CallbackHandler {
handle: UnicastCallbackHandle,
) -> Result<()> {
trace!("unregistering unicast callback");
if self.unicast_callbacks.remove(&(handle.0 .0 as isize)).is_some() {
if self
.unicast_callbacks
.remove(&(handle.0 .0 as isize))
.is_some()
{
unsafe {
let r = windows::Win32::NetworkManagement::IpHelper::CancelMibChangeNotify2(handle.0);
let r =
windows::Win32::NetworkManagement::IpHelper::CancelMibChangeNotify2(handle.0);
if r.is_err() {
return Err(anyhow::anyhow!("CancelMibChangeNotify2 failed: {:?}", r));
}
Expand Down Expand Up @@ -158,9 +166,14 @@ impl CallbackHandler {

fn unregister_route_change_callback(&mut self, handle: RouteCallbackHandle) -> Result<()> {
trace!("unregistering route callback");
if self.route_callbacks.remove(&(handle.0 .0 as isize)).is_some() {
if self
.route_callbacks
.remove(&(handle.0 .0 as isize))
.is_some()
{
unsafe {
let r = windows::Win32::NetworkManagement::IpHelper::CancelMibChangeNotify2(handle.0);
let r =
windows::Win32::NetworkManagement::IpHelper::CancelMibChangeNotify2(handle.0);
if r.is_err() {
return Err(anyhow::anyhow!("CancelMibChangeNotify2 failed: {:?}", r));
}
Expand Down

0 comments on commit 47cfb40

Please sign in to comment.