From 3c7b276188028031e287d9472fc8480c59684dfb Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 2 Sep 2019 14:13:36 +0100 Subject: [PATCH] catch and rethrow gaierrors in mumble.py --- modules/mumble.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/mumble.py b/modules/mumble.py index f2625ee9..877c735e 100644 --- a/modules/mumble.py +++ b/modules/mumble.py @@ -20,7 +20,11 @@ class Module(ModuleManager.BaseModule): timestamp = datetime.datetime.utcnow().microsecond ping_packet = struct.pack(">iQ", 0, timestamp) s = socket.socket(type=socket.SOCK_DGRAM) - s.sendto(ping_packet, (server, port)) + + try: + s.sendto(ping_packet, (server, port)) + except socket.gaierror as e: + raise utils.EventError(str(e)) pong_packet = s.recv(24) pong = struct.unpack(">bbbbQiii", pong_packet)