Exemple #1
0
class UBRSWebDaemon(Daemon):
    def __init__(self):
        Daemon.__init__(self, 'ubrs.pid')
        self.ip = config.HTTP_IP
        self.port = config.HTTP_PORT
        self.relay = Relay(os.path.join(os.getcwd(), config.UBR_PATH))
        self.app = UBRSApplication(self.relay)

    # methode principale, appele par start()
    # lance l'interface web tornado
    def run(self):
        self.app.listen(self.port)
        tornado.ioloop.IOLoop.instance().start()

    # on arrete proprement le serveur
    def stop(self):
        tornado.ioloop.IOLoop.instance().stop()
        self.relay.stop_and_clean()
        Daemon.stop(self)