Ignore "Destination address required" error
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Dominik Heidler 2023-11-04 00:26:38 +01:00
parent 511d58e9c5
commit f8d414b4ae

View file

@ -30,7 +30,13 @@ while True:
print(f"{UDP_IP}:{UDP_PORT} {MESSAGE=}" % MESSAGE)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.bind(('0.0.0.0', 1900)) # 1900 is SSDP src port
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
try:
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
except OSError:
# OSError: [Errno 89] Destination address required
# this error means that wireguard doesn't know an endpoint for this peer
# so we can ignore this error
pass
sock.close()
time.sleep(10)