From aa6e53e2faecde8742b6523b52694f15b74ce170 Mon Sep 17 00:00:00 2001 From: dave Date: Sun, 17 Sep 2017 20:45:57 -0700 Subject: [PATCH] fix port range arg --- examples/ping.py | 8 +++++++- msgbus/server.py | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/ping.py b/examples/ping.py index ad99c78..71e903f 100644 --- a/examples/ping.py +++ b/examples/ping.py @@ -31,7 +31,13 @@ def ping(host, port, count=5, interval=1): _, msg = client.recv() recvtime = time() seq, msgtime, remotetime = msg.split(" ") - print("ping(): < {} {} rtt: {:f}\n".format(_, seq, round(recvtime - float(msgtime), 8))) + msgtime = float(msgtime) + remotetime = float(remotetime) + transittime = recvtime - msgtime + # out = remotetime - msgtime + # back = recvtime - remotetime + # These aren't printed because clock sync imperfection makes them unreliable + print("ping(): < {} {} rtt: {:f}\n".format(_, seq, round(transittime, 8))) recv = Thread(target=ping_recver) recv.daemon = True diff --git a/msgbus/server.py b/msgbus/server.py index b90ceb9..87b7179 100644 --- a/msgbus/server.py +++ b/msgbus/server.py @@ -348,8 +348,9 @@ def main(): with zmq.asyncio.Context() as ctx: loop = asyncio.get_event_loop() # loop.set_debug(True) + port_range = (int(args.port_range[0]), int(args.port_range[1])) server = MsgBusServer(loop, ctx, args.bind_host, int(args.port), int(args.port) + 1, - port_range=args.port_range, peers=args.peers if args.peers else [], + port_range=port_range, peers=args.peers if args.peers else [], name=args.name) def signal_handler(signum, stack):