X-Git-Url: http://average.org/gitweb/?a=blobdiff_plain;f=loctrkd%2Frectifier.py;h=1da57528d733a52df0be0955f18d7d29ce86d49b;hb=f24ba18e34cbfe34bf648459f0e80bd874334fe4;hp=47d9d055f8471357d5edb748f580cbaf6be90169;hpb=456fcc5a8964c84385d34a6687e83ae05ab2ddc3;p=loctrkd.git diff --git a/loctrkd/rectifier.py b/loctrkd/rectifier.py index 47d9d05..1da5752 100644 --- a/loctrkd/rectifier.py +++ b/loctrkd/rectifier.py @@ -51,7 +51,7 @@ def runserver(conf: ConfigParser) -> None: zpush = zctx.socket(zmq.PUSH) # type: ignore zpush.connect(conf.get("collector", "listenurl")) zpub = zctx.socket(zmq.PUB) # type: ignore - zpub.connect(conf.get("rectifier", "publishurl")) + zpub.bind(conf.get("rectifier", "publishurl")) try: while True: @@ -89,19 +89,21 @@ def runserver(conf: ConfigParser) -> None: ) log.debug("Sending reponse %s", resp) zpush.send(resp.packed) + rept = CoordReport( + devtime=rect.devtime, + battery_percentage=rect.battery_percentage, + accuracy=-1, + altitude=-1, + speed=-1, + direction=-1, + latitude=lat, + longitude=lon, + ) + log.debug("Sending report %s", rept) zpub.send( Rept( imei=zmsg.imei, - payload=CoordReport( - devtime=rect.devtime, - battery_percentage=rect.battery_percentage, - accuracy=-1, - altitude=-1, - speed=-1, - direction=-1, - latitude=lat, - longitude=lon, - ).json, + payload=rept.json, ).packed ) except Exception as e: