catch and rethrow gaierrors in mumble.py

This commit is contained in:
jesopo 2019-09-02 14:13:36 +01:00
parent 43a7b7d949
commit 3c7b276188

View file

@ -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)
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)