Skip to content

Commit

Permalink
Wait until tunnels have been removed from babel before deleting them
Browse files Browse the repository at this point in the history
This resolves the issue described here sudomesh/bugs#24
Where babel will be uanble to free it's resources for the interface and run out of
memory
  • Loading branch information
jkilpatr committed Feb 7, 2020
1 parent b8e21c6 commit f246029
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rita/src/rita_common/tunnel_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ impl Tunnel {
Ok(())
});
Arbiter::spawn(fut);
} else {
// We must wait until we have flushed the interface before deleting it
// otherwise we will experience this error
// https://github.com/sudomesh/bugs/issues/24
if let Err(e) = KI.del_interface(&tunnel.iface_name) {
error!("Failed to delete wg interface! {:?}", e);
}
TunnelManager::from_registry().do_send(PortCallback(tunnel.listen_port));
}
Ok(())
}),
Expand Down Expand Up @@ -572,8 +580,6 @@ impl Handler<TriggerGC> for TunnelManager {
// In the same spirit, we return the port to the free port pool only after tunnel
// deletion goes well.
tunnel.unmonitor(0);
KI.del_interface(&tunnel.iface_name)?;
self.free_ports.push(tunnel.listen_port);
}
}

Expand Down

0 comments on commit f246029

Please sign in to comment.