Commit 5de40886 authored by Boris Pilka's avatar Boris Pilka

Cleaned up main()


Former-commit-id: 35d6db04
parent cb9afd65
import argparse
import logging
import sys
import time
import waitress
from bp_daemon.bp_daemon import BPServer, BPClient
from bp_daemon.bp_daemon import BPServer
from ipnd import httpd
parser = argparse.ArgumentParser()
......@@ -16,26 +13,13 @@ parser.add_argument("--upcn-host", type=str, default="127.0.0.1")
parser.add_argument("--upcn-port", type=int, default=4556)
args = parser.parse_args()
# Start server
# Start Bundle protocol server
bp = BPServer()
bp.port = args.port
bp.start()
# Start REST endpoint
httpd.node = args.node
httpd.upcn_host = args.upcn_host
httpd.upcn_port = args.upcn_port
waitress.serve(httpd.app, host='0.0.0.0', port=args.http_port)
# Start client
bp_client = BPClient(node=args.node)
bp_client.node = args.node
bp_client.host = args.upcn_host
bp_client.port = args.upcn_port
bp_client.start()
bp_client.send_contact_msg()
bp_client.close()
try:
while True:
time.sleep(0.5)
except KeyboardInterrupt:
logging.warn("Exiting due to ^C...")
sys.exit(1)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment