Stop UDPSocket on socket.error 101 (Network is unreachable)

This commit is contained in:
Dmitri Bogomolov 2019-12-14 12:53:51 +02:00
parent 5a35de6bca
commit 03316496b7
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -146,6 +146,9 @@ class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes
retval = self.socket.sendto( retval = self.socket.sendto(
self.write_buf, ('<broadcast>', self.port)) self.write_buf, ('<broadcast>', self.port))
except socket.error as e: 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 retval = 0
self.slice_write_buf(retval) self.slice_write_buf(retval)