X-Git-Url: http://www.average.org/gitweb/?a=blobdiff_plain;f=loctrkd%2F__main__.py;h=8808c8a31c092fdc78dc2a674f5932740622a865;hb=HEAD;hp=bba38ff1f1321f3ac76a62e69eefebe7db8c0bc9;hpb=9bf81b19b7b790bc2115ac08dc1f3c112aede976;p=loctrkd.git diff --git a/loctrkd/__main__.py b/loctrkd/__main__.py index bba38ff..8808c8a 100644 --- a/loctrkd/__main__.py +++ b/loctrkd/__main__.py @@ -17,17 +17,9 @@ from .zmsg import Bcast, Resp log = getLogger("loctrkd") -pmods: List[ProtoModule] = [] - - def main( conf: ConfigParser, opts: List[Tuple[str, str]], args: List[str] ) -> None: - global pmods - pmods = [ - cast(ProtoModule, import_module("." + modnm, __package__)) - for modnm in conf.get("common", "protocols").split(",") - ] # Is this https://github.com/zeromq/pyzmq/issues/1627 still not fixed?! zctx = zmq.Context() # type: ignore zpush = zctx.socket(zmq.PUSH) # type: ignore @@ -40,12 +32,8 @@ def main( imei = args[0] cmd = args[1] args = args[2:] - handled = False - for pmod in pmods: - if pmod.proto_handled(cmd): - handled = True - break - if not handled: + pmod = common.pmod_for_proto(cmd) + if pmod is None: raise NotImplementedError(f"No protocol can handle {cmd}") cls = pmod.class_by_prefix(cmd) if isinstance(cls, list):