shill: openvpn: Improve openvpn shutdown and resource cleanup.
This patch includes two changes:
- Improves ProcessKiller to guard against the case where shill has
already reaped the dead child process but ProcessKiller ignored that
fact because a child watch had been registered and was removed in
the meantime.
- OpenVPNDriver removes the child watch callback before disconnecting
the management interface to ensure cleaner termination and reaping
of the openvpn process through ProcessKiller.
BUG=chromium-os:39638
TEST=unit tests; tested on device by connecting and disconnecting to
OpenVPN and observing no left-over tun* interfaces or openvpn
processes; tested on device by manually modifying shill to sleep after
stopping the OpenVPN interface and observing no left-over tun*
interfaces or openvpn processes.
Change-Id: I19168cec3f5445938c910462b4a390bdbbc82639
Reviewed-on: https://gerrit.chromium.org/gerrit/45308
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>
diff --git a/mock_process_killer.h b/mock_process_killer.h
index 6240b5a..6399f34 100644
--- a/mock_process_killer.h
+++ b/mock_process_killer.h
@@ -16,7 +16,7 @@
MockProcessKiller();
virtual ~MockProcessKiller();
- MOCK_METHOD2(Wait, void(int pid, const base::Closure &callback));
+ MOCK_METHOD2(Wait, bool(int pid, const base::Closure &callback));
MOCK_METHOD2(Kill, void(int pid, const base::Closure &callback));
private: