summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--talpid_core/src/tunnel/mod.rs2
-rw-r--r--talpid_core/src/tunnel/openvpn.rs9
2 files changed, 5 insertions, 6 deletions
diff --git a/talpid_core/src/tunnel/mod.rs b/talpid_core/src/tunnel/mod.rs
index 3c955c563d..aead09b13b 100644
--- a/talpid_core/src/tunnel/mod.rs
+++ b/talpid_core/src/tunnel/mod.rs
@@ -90,7 +90,7 @@ pub struct CloseHandle(OpenVpnCloseHandle);
impl CloseHandle {
/// Closes the underlying tunnel, making the `TunnelMonitor::wait` method return.
- pub fn close(&self) -> io::Result<()> {
+ pub fn close(self) -> io::Result<()> {
self.0.close()
}
}
diff --git a/talpid_core/src/tunnel/openvpn.rs b/talpid_core/src/tunnel/openvpn.rs
index 651d7c3ca9..08c2c14a32 100644
--- a/talpid_core/src/tunnel/openvpn.rs
+++ b/talpid_core/src/tunnel/openvpn.rs
@@ -146,8 +146,7 @@ pub struct OpenVpnCloseHandle {
impl OpenVpnCloseHandle {
/// Kills the underlying OpenVPN process, making the `OpenVpnMonitor::wait` method return.
- /// Only tries to close the OpenVPN process the first time it's called.
- pub fn close(&self) -> io::Result<()> {
+ pub fn close(self) -> io::Result<()> {
if !self.closed.swap(true, Ordering::SeqCst) {
self.kill_openvpn()
} else {
@@ -156,12 +155,12 @@ impl OpenVpnCloseHandle {
}
#[cfg(unix)]
- fn kill_openvpn(&self) -> io::Result<()> {
- ::process::unix::nice_kill(self.child.clone(), *OPENVPN_DIE_TIMEOUT)
+ fn kill_openvpn(self) -> io::Result<()> {
+ ::process::unix::nice_kill(self.child, *OPENVPN_DIE_TIMEOUT)
}
#[cfg(not(unix))]
- fn kill_openvpn(&self) -> io::Result<()> {
+ fn kill_openvpn(self) -> io::Result<()> {
self.child.kill()
}
}