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

* [govee] make socket close more resilient

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
stefan-hoehn 2024-08-19 09:18:07 +02:00 committed by Ciprian Pascu
parent 396ff0b7c3
commit 6f9b3d2bbf

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;
}