X-Git-Url: http://average.org/gitweb/?a=blobdiff_plain;f=gps303%2Ftermconfig.py;h=723e8f62766ef542dbdb337ae015c66203ff1b9c;hb=18eda7307e92eeee6a9e2fdd2e810f98d25df654;hp=eb3150b49a17065aed2fc1d8898bc80ffa4e28b7;hpb=380ccd781fef5b1ee98e9660c748c8955d3bf40e;p=loctrkd.git diff --git a/gps303/termconfig.py b/gps303/termconfig.py index eb3150b..723e8f6 100644 --- a/gps303/termconfig.py +++ b/gps303/termconfig.py @@ -14,7 +14,6 @@ log = getLogger("gps303/termconfig") def runserver(conf: ConfigParser) -> None: - termconfig = common.normconf(conf["termconfig"]) # Is this https://github.com/zeromq/pyzmq/issues/1627 still not fixed?! zctx = zmq.Context() # type: ignore zsub = zctx.socket(zmq.SUB) # type: ignore @@ -43,6 +42,12 @@ def runserver(conf: ConfigParser) -> None: log.error( "%s does not expect externally provided response", msg ) + if zmsg.imei is not None and conf.has_section(zmsg.imei): + termconfig = common.normconf(conf[zmsg.imei]) + elif conf.has_section("termconfig"): + termconfig = common.normconf(conf["termconfig"]) + else: + termconfig = {} kwargs = {} if isinstance(msg, STATUS): kwargs = { @@ -71,7 +76,9 @@ def runserver(conf: ConfigParser) -> None: zpush.send(resp.packed) except KeyboardInterrupt: - pass + zsub.close() + zpush.close() + zctx.destroy() # type: ignore if __name__.endswith("__main__"):