Ejemplo n.º 1
0
def run_server(args):
    setup_logging(args)
    with open(args.config_file, "r") as rf:
        node = Node.from_config(MessageHandler(), json.load(rf), hooks=Hooks())

    with run_node(node):
        log("Listening on {0}".format(node.address))
        # NOTE: There is no functionality for flipping the SHUTDOWN switch, so at this point you'll
        #       have to terminate the process manually.
        while not SHUTDOWN:
            time.sleep(1)
Ejemplo n.º 2
0
 def test_from_config(self):
   cfg = self.node.get_config()
   cfg["address"] = ":".join(str(o) for o in addr_2)
   node = Node.from_config(handle_message, cfg)