| stat.S_IROTH | stat.S_IWOTH | stat.S_IXOTH) break except Exception as e: logging.exception("[%s]: Starting server failed. " % fileName + "Try again in 5 seconds.") time.sleep(5) serverThread = threading.Thread(target=server.serve_forever) # set thread to daemon # => threads terminates when main thread terminates serverThread.daemon = True serverThread.start() # only start version informer if the update check is activated logging.info("[%s] Starting version informer thread." % fileName) globalData.versionInformer = VersionInformer(updateServer, updatePort, updateLocation, updateCaFile, updateInterval, globalData) # set thread to daemon # => threads terminates when main thread terminates globalData.versionInformer.daemon = True globalData.versionInformer.start() logging.info("[%s] Client started." % fileName) # generate receiver to handle incoming data (for example status updates) receiver = Receiver(globalData.serverComm) receiver.run()
serverThread.start() # start a watchdog thread that controls all server sessions globalData.logger.info("[%s] Starting watchdog thread." % fileName) globalData.connectionWatchdog = ConnectionWatchdog(globalData, globalData.connectionTimeout) # set thread to daemon # => threads terminates when main thread terminates globalData.connectionWatchdog.daemon = True globalData.connectionWatchdog.start() # Only start version informer if update check is available. if updateActivated is True: globalData.logger.info("[%s] Starting version checker thread." % fileName) versionInformer = VersionInformer(updateServer, updatePort, updateLocation, updateCaFile, updateInterval, globalData) # set thread to daemon # => threads terminates when main thread terminates versionInformer.daemon = True versionInformer.start() # only start survey executer if user wants to participate if surveyActivated: globalData.logger.info("[%s] Starting survey executer thread." % fileName) surveyExecuter = SurveyExecuter(updateActivated, updateServer, updateLocation, globalData) # set thread to daemon # => threads terminates when main thread terminates surveyExecuter.daemon = True surveyExecuter.start()