broadcast receive fix 3

This commit is contained in:
2024-06-22 17:48:51 +02:00
parent e67b0380dc
commit 417da8d94c
2 changed files with 9 additions and 2 deletions

View File

@@ -37,6 +37,7 @@ public class LocalPeerDiscoveryBroadcaster {
}
void shutdown(@Observes @Priority(10) ShutdownEvent event) {
_socket.close();
_broadcasterThread.interrupt();
while (_broadcasterThread.isAlive()) {
try {
@@ -44,7 +45,6 @@ public class LocalPeerDiscoveryBroadcaster {
} catch (InterruptedException ignored) {
}
}
}
private void broadcast() {

View File

@@ -36,8 +36,15 @@ public class LocalPeerDiscoveryClient {
}
void shutdown(@Observes @Priority(10) ShutdownEvent event) throws InterruptedException {
_socket.close();
_clientThread.interrupt();
_clientThread.join();
_clientThread.interrupt();
while (_clientThread.isAlive()) {
try {
_clientThread.join();
} catch (InterruptedException ignored) {
}
}
}
private void client() {