diff options
| author | Linus Färnstrand <faern@faern.net> | 2023-07-06 16:03:14 +0200 |
|---|---|---|
| committer | Linus Färnstrand <faern@faern.net> | 2023-07-07 14:52:18 +0200 |
| commit | 7455706dc037898f445d262f6359a4a53c4392a0 (patch) | |
| tree | 145faf00aa6cadcf68149e61a378e42db0af90a3 | |
| parent | 8e827e8a02b68c7f999fe287f53e764d648cff6f (diff) | |
| download | mullvadvpn-7455706dc037898f445d262f6359a4a53c4392a0.tar.xz mullvadvpn-7455706dc037898f445d262f6359a4a53c4392a0.zip | |
Improve documentation on OpenVpnProcHandle
| -rw-r--r-- | talpid-openvpn/src/process/openvpn.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/talpid-openvpn/src/process/openvpn.rs b/talpid-openvpn/src/process/openvpn.rs index 1ca2cb3958..722468e3ca 100644 --- a/talpid-openvpn/src/process/openvpn.rs +++ b/talpid-openvpn/src/process/openvpn.rs @@ -363,17 +363,20 @@ impl fmt::Display for OpenVpnCommand { } } -/// Proc handle for an openvpn process +/// Handle to a running OpenVPN process. pub struct OpenVpnProcHandle { /// Duct handle pub inner: duct::Handle, - /// Standard input handle + /// Pipe handle to stdin of the OpenVPN process. Our custom fork of OpenVPN + /// has been changed so that it exits cleanly when stdin is closed. This is a hack + /// solution to cleanly shut OpenVPN down without using the + /// management interface (which would be the correct thing to do). pub stdin: Mutex<Option<PipeWriter>>, } -/// Impl for proc handle impl OpenVpnProcHandle { - /// Constructor for a new openvpn proc handle + /// Configures the expression to run OpenVPN in a way compatible with this handle + /// and spawns it. Returns the handle. pub fn new(mut cmd: duct::Expression) -> io::Result<Self> { use is_terminal::IsTerminal; @@ -396,10 +399,9 @@ impl OpenVpnProcHandle { } impl StoppableProcess for OpenVpnProcHandle { - /// Closes STDIN to stop the openvpn process fn stop(&self) { // Dropping our stdin handle so that it is closed once. Closing the handle should - // gracefully stop our openvpn child process. + // gracefully stop our OpenVPN child process. if self.stdin.lock().take().is_none() { log::warn!("Tried to close OpenVPN stdin handle twice, this is a bug"); } |
