Commit accb4ecc authored by rjharmon's avatar rjharmon Committed by Brian May

Run all systemd notifications from main process

parent ee36cc0d
...@@ -11,6 +11,7 @@ import sshuttle.helpers as helpers ...@@ -11,6 +11,7 @@ import sshuttle.helpers as helpers
import sshuttle.ssnet as ssnet import sshuttle.ssnet as ssnet
import sshuttle.ssh as ssh import sshuttle.ssh as ssh
import sshuttle.ssyslog as ssyslog import sshuttle.ssyslog as ssyslog
import sshuttle.sdnotify as sdnotify
from sshuttle.ssnet import SockWrapper, Handler, Proxy, Mux, MuxWrapper from sshuttle.ssnet import SockWrapper, Handler, Proxy, Mux, MuxWrapper
from sshuttle.helpers import log, debug1, debug2, debug3, Fatal, islocal, \ from sshuttle.helpers import log, debug1, debug2, debug3, Fatal, islocal, \
resolvconf_nameservers resolvconf_nameservers
...@@ -518,6 +519,8 @@ def _main(tcp_listener, udp_listener, fw, ssh_cmd, remotename, ...@@ -518,6 +519,8 @@ def _main(tcp_listener, udp_listener, fw, ssh_cmd, remotename,
# ignore its contents. # ignore its contents.
mux.got_routes = None mux.got_routes = None
fw.start() fw.start()
sdnotify.send(sdnotify.ready(), sdnotify.status('Connected'))
mux.got_routes = onroutes mux.got_routes = onroutes
def onhostlist(hostlist): def onhostlist(hostlist):
...@@ -798,6 +801,8 @@ def main(listenip_v6, listenip_v4, ...@@ -798,6 +801,8 @@ def main(listenip_v6, listenip_v4,
# it's not our child anymore; can't waitpid # it's not our child anymore; can't waitpid
fw.p.returncode = 0 fw.p.returncode = 0
fw.done() fw.done()
sdnotify.send(sdnotify.stop())
finally: finally:
if daemon: if daemon:
daemon_cleanup() daemon_cleanup()
...@@ -7,7 +7,6 @@ import platform ...@@ -7,7 +7,6 @@ import platform
import traceback import traceback
import sshuttle.ssyslog as ssyslog import sshuttle.ssyslog as ssyslog
import sshuttle.sdnotify as sdnotify
from sshuttle.helpers import debug1, debug2, Fatal from sshuttle.helpers import debug1, debug2, Fatal
from sshuttle.methods import get_auto_method, get_method from sshuttle.methods import get_auto_method, get_method
...@@ -220,8 +219,6 @@ def main(method_name, syslog): ...@@ -220,8 +219,6 @@ def main(method_name, syslog):
user) user)
stdout.write('STARTED\n') stdout.write('STARTED\n')
sdnotify.send(sdnotify.ready(),
sdnotify.status('Connected'))
try: try:
stdout.flush() stdout.flush()
...@@ -247,7 +244,6 @@ def main(method_name, syslog): ...@@ -247,7 +244,6 @@ def main(method_name, syslog):
break break
finally: finally:
try: try:
sdnotify.send(sdnotify.stop())
debug1('firewall manager: undoing changes.\n') debug1('firewall manager: undoing changes.\n')
except BaseException: except BaseException:
debug2('An error occurred, ignoring it.') debug2('An error occurred, ignoring it.')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment