From 03316496b7c3380c5ac408f86d049855dbcedac6 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Sat, 14 Dec 2019 12:53:51 +0200 Subject: [PATCH] Stop UDPSocket on socket.error 101 (Network is unreachable) --- src/network/udp.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/udp.py b/src/network/udp.py index cf694567..d8c5f340 100644 --- a/src/network/udp.py +++ b/src/network/udp.py @@ -146,6 +146,9 @@ class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes retval = self.socket.sendto( self.write_buf, ('', self.port)) except socket.error as e: - logger.error("socket error on sendato: %s", e) + logger.error("socket error on sendto: %s", e) + if e.errno == 101: + self.announcing = False + self.socket.close() retval = 0 self.slice_write_buf(retval)