mirror of
https://github.com/Genymobile/scrcpy
synced 2025-01-18 13:11:46 +00:00
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 9c08eb79cb
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…
Reference in New Issue
Block a user