Close connection at the end of finally-block

The async processors use the socket file descriptors from the
connection. Therefore, the connection must not be closed before all
async processor threads are joined.

PR #3978 <https://github.com/Genymobile/scrcpy/pull/3978>
pull/3978/head
Romain Vimont 1 year ago
parent 92483fe11b
commit 9c08eb79cb

@ -92,7 +92,8 @@ public final class Server {
List<AsyncProcessor> asyncProcessors = new ArrayList<>();
try (DesktopConnection connection = DesktopConnection.open(scid, tunnelForward, audio, control, sendDummyByte)) {
DesktopConnection connection = DesktopConnection.open(scid, tunnelForward, audio, control, sendDummyByte);
try {
if (options.getSendDeviceMeta()) {
connection.sendDeviceMeta(Device.getDeviceName());
}
@ -150,6 +151,8 @@ public final class Server {
} catch (InterruptedException e) {
// ignore
}
connection.close();
}
}

Loading…
Cancel
Save