[govee] make socket close more resilient (#17286)

* [govee] make socket close more resilient

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
This commit is contained in:
stefan-hoehn 2024-08-19 09:18:07 +02:00 committed by GitHub
parent d33b2ff0d1
commit 5ae87b8dee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -200,7 +200,12 @@ public class CommunicationManager {
socket.setReuseAddress(true);
while (!stopped) {
DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
socket.receive(packet);
if (!socket.isClosed()) {
socket.receive(packet);
} else {
logger.warn("Socket was unexpectedly closed");
break;
}
if (stopped) {
break;
}