def _setup_environment(self): """Finish misc startup tasks like starting logging, zipping any crash logs from the last run, installing signal handlers, startup argument handler, etc""" #apply the necessary hacks: Twisted.apply_dns_hack() Twisted.apply_dns_hack2() if System.IS_WINDOWS: Win32HiddenWindowHack.apply() #start listening for connections from any other instances of BitBlinder StartupServer.start() Profiler.start() #Make sure we log ALL exceptions Twisted.install_exception_handlers(self.on_quit_signal) #Set the signal handler for exiting def sig_handler(signum, frame): self.on_quit_signal() signal.signal(signal.SIGTERM, sig_handler) #make the gui: GUIController.start() self.gui = GUIController.get() #do some tests to see how this user's network is configured: NetworkState.test_network_state() #TODO: figure out what needs to change in the wrapper and submit a fix warnings.filterwarnings('ignore', module=".*TwistedProtocolWrapper.*", lineno=447)
def main(): Twisted.install_exception_handlers() Globals.reactor = reactor reactor.listenTCP(options.port, TCPServer()) reactor.listenUDP(options.port, UDPServer()) log_msg('Server is listening on port: %s!' % (options.port), 2) reactor.run() log_msg("Shutdown cleanly", 2)
def main(): """Launches the Serverfactoryprotocolthing """ #run as a daemon Globals.logger = Logger.Logger(options.debug) Globals.logger.start_logs(["BANK", "errors"], "BANK", ".") Twisted.install_exception_handlers() BankUtil.update_local_acoin_interval(start_listening, on_new_interval) Globals.reactor = reactor log_msg('Server started: fail is imminent (not an error)!', 0) if Globals.DEBUG: def start_profiler(): Globals.PROFILER.clear() Globals.PROFILER.enable() def stop_profiler(): Globals.PROFILER.disable() Globals.PROFILER.dump_stats("temp.stats") reactor.callLater(15.0, start_profiler) reactor.callLater(75.0, stop_profiler) reactor.run() ACoinMessages.eventLogger.on_shutdown() log_msg("Shutdown cleanly", 2)