diff options
author | rjharmon <42002+rjharmon@users.noreply.github.com> | 2020-03-18 14:07:09 -0700 |
---|---|---|
committer | Brian May <brian@linuxpenguins.xyz> | 2020-03-24 16:15:41 +1100 |
commit | accb4ecc977a3a65d32ad4fb97c19f4d17be9177 (patch) | |
tree | cf91e8363c3c527e942bfee8b2c7c03d3b159f39 | |
parent | ee36cc0d00c43f723fea3058cd1510abdafd1804 (diff) |
Run all systemd notifications from main process
-rw-r--r-- | sshuttle/client.py | 5 | ||||
-rw-r--r-- | sshuttle/firewall.py | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/sshuttle/client.py b/sshuttle/client.py index edb50a0..5e4009e 100644 --- a/sshuttle/client.py +++ b/sshuttle/client.py @@ -11,6 +11,7 @@ import sshuttle.helpers as helpers import sshuttle.ssnet as ssnet import sshuttle.ssh as ssh import sshuttle.ssyslog as ssyslog +import sshuttle.sdnotify as sdnotify from sshuttle.ssnet import SockWrapper, Handler, Proxy, Mux, MuxWrapper from sshuttle.helpers import log, debug1, debug2, debug3, Fatal, islocal, \ resolvconf_nameservers @@ -518,6 +519,8 @@ def _main(tcp_listener, udp_listener, fw, ssh_cmd, remotename, # ignore its contents. mux.got_routes = None fw.start() + sdnotify.send(sdnotify.ready(), sdnotify.status('Connected')) + mux.got_routes = onroutes def onhostlist(hostlist): @@ -798,6 +801,8 @@ def main(listenip_v6, listenip_v4, # it's not our child anymore; can't waitpid fw.p.returncode = 0 fw.done() + sdnotify.send(sdnotify.stop()) + finally: if daemon: daemon_cleanup() diff --git a/sshuttle/firewall.py b/sshuttle/firewall.py index d045921..ced6e05 100644 --- a/sshuttle/firewall.py +++ b/sshuttle/firewall.py @@ -7,7 +7,6 @@ import platform import traceback import sshuttle.ssyslog as ssyslog -import sshuttle.sdnotify as sdnotify from sshuttle.helpers import debug1, debug2, Fatal from sshuttle.methods import get_auto_method, get_method @@ -220,8 +219,6 @@ def main(method_name, syslog): user) stdout.write('STARTED\n') - sdnotify.send(sdnotify.ready(), - sdnotify.status('Connected')) try: stdout.flush() @@ -247,7 +244,6 @@ def main(method_name, syslog): break finally: try: - sdnotify.send(sdnotify.stop()) debug1('firewall manager: undoing changes.\n') except BaseException: debug2('An error occurred, ignoring it.') |