Shutdown connection before joining threads
Interrupting async processors may require to shutdown the connection to wake up blocking calls. Therefore, shutdown the connection first, then join the threads, then close the connection. Refs commit 9c08eb79cb7941848882cb908cefee9933450de5
This commit is contained in:
parent
b8c5853aa6
commit
ff579990c2
@ -132,20 +132,29 @@ public final class DesktopConnection implements Closeable {
|
||||
return controlSocket;
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
public void shutdown() throws IOException {
|
||||
if (videoSocket != null) {
|
||||
videoSocket.shutdownInput();
|
||||
videoSocket.shutdownOutput();
|
||||
videoSocket.close();
|
||||
}
|
||||
if (audioSocket != null) {
|
||||
audioSocket.shutdownInput();
|
||||
audioSocket.shutdownOutput();
|
||||
audioSocket.close();
|
||||
}
|
||||
if (controlSocket != null) {
|
||||
controlSocket.shutdownInput();
|
||||
controlSocket.shutdownOutput();
|
||||
}
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
if (videoSocket != null) {
|
||||
videoSocket.close();
|
||||
}
|
||||
if (audioSocket != null) {
|
||||
audioSocket.close();
|
||||
}
|
||||
if (controlSocket != null) {
|
||||
controlSocket.close();
|
||||
}
|
||||
}
|
||||
|
@ -163,6 +163,8 @@ public final class Server {
|
||||
asyncProcessor.stop();
|
||||
}
|
||||
|
||||
connection.shutdown();
|
||||
|
||||
try {
|
||||
initThread.join();
|
||||
for (AsyncProcessor asyncProcessor : asyncProcessors) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user