Run all systemd notifications from main process

This commit is contained in:
rjharmon
2020-03-18 14:07:09 -07:00
committed by Brian May
parent ee36cc0d00
commit accb4ecc97
2 changed files with 5 additions and 4 deletions

View File

@ -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()