Fix signal handler in daemon mode

- signal handler requires the main thread to run
This commit is contained in:
Peter Šurda 2017-07-30 09:36:20 +02:00
parent 3e6de7a9ad
commit 7a4551e1e7
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -27,6 +27,7 @@ import socket
import ctypes import ctypes
from struct import pack from struct import pack
from subprocess import call from subprocess import call
from time import sleep
from api import MySimpleXMLRPCRequestHandler, StoppableXMLRPCServer from api import MySimpleXMLRPCRequestHandler, StoppableXMLRPCServer
from helper_startup import isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections from helper_startup import isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections
@ -315,6 +316,10 @@ class Main:
else: else:
BMConfigParser().remove_option('bitmessagesettings', 'dontconnect') BMConfigParser().remove_option('bitmessagesettings', 'dontconnect')
if daemon:
while state.shutdown == 0:
sleep(1)
def daemonize(self): def daemonize(self):
try: try:
if os.fork(): if os.fork():