def run(self): self.pipeline.configure() self.pipeline.start() self.netclock.start() self.do_run = True self.log.info('running GObject-MainLoop') MainLoop.run()
def main(): global conf, macMapping, hostAddress, t, ready, ncdict, pipeline # configure logging docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty()) handler = LogHandler(docolor) logging.root.addHandler(handler) if Args.verbose >= 2: level = logging.DEBUG elif Args.verbose == 1: level = logging.INFO else: level = logging.WARNING level = logging.DEBUG logging.root.setLevel(level) #load config conf = loadconfig("config.json") macMapping = conf["macMapping"] hostAddress = conf["hostAddress"] #start server t = threading.Thread(target=run_server) t.start() if clearOnStart: try: shutil.rmtree("./config") except FileNotFoundError: pass while not ready: try: time.sleep(2) print("\x1b[2J\x1b[H") monitorManager.load() print('syncstream ready') print('- registered clients -') for mon in monitorManager.monitors: print('{}: {} ({})'.format(mon.index, mon.ip, mon.mac)) print('press ctrl+c to start') except KeyboardInterrupt: print('Starting!') # make killable by ctrl-c logging.debug('setting SIGINT handler') signal.signal(signal.SIGINT, signal.SIG_DFL) # init main-class and main-loop logging.debug('Creating Pipeline') pipeline = Pipeline() source = TCPSource(9999) netclock = NetClock(pipeline, None, 10000) pipeline.configure() pipeline.start() netclock.start() ncdict = netclock.netprov ready = True logging.info('running GObject MainLoop') MainLoop.run()
def run(self): self.pipeline.configure() self.pipeline.start() try: self.log.info('running GObject-MainLoop') MainLoop.run() except KeyboardInterrupt: self.log.info('Terminated via Ctrl-C')
def run(self): try: self.log.info('running GObject-MainLoop') MainLoop.run() except KeyboardInterrupt: self.log.info('Terminated via Ctrl-C')