master.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:rebus 作者: airbus-seclab 项目源码 文件源码
def run(cls, store, master_options):
        gobject.threads_init()
        dbus.glib.init_threads()
        DBusGMainLoop(set_as_default=True)

        bus = dbus.SessionBus()
        name = dbus.service.BusName("com.airbus.rebus.bus", bus)
        svc = cls(bus, "/bus", store)

        svc.mainloop = gobject.MainLoop()
        log.info("Entering main loop.")
        try:
            svc.mainloop.run()
        except (KeyboardInterrupt, SystemExit):
            if len(svc.clients) > 0:
                log.info("Trying to stop all agents properly. Press Ctrl-C "
                         "again to stop.")
                # stop scheduler
                svc.sched.shutdown()
                # ask slave agents to shutdown nicely & save internal state
                log.info("Expecting %u more agents to exit (ex. %s)",
                         len(svc.clients), svc.clients.keys()[0])
                svc.bus_exit(store.STORES_INTSTATE)
                store.store_state()
                try:
                    svc.mainloop.run()
                except (KeyboardInterrupt, SystemExit):
                    if len(svc.clients) > 0:
                        log.info(
                            "Not all agents have stopped, exiting nonetheless")
        log.info("Stopping storage...")
        store.store_state()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号