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>
This commit is contained in:
Romain Vimont 2023-04-09 19:12:39 +02:00
parent 92483fe11b
commit 9c08eb79cb

View file

@ -92,7 +92,8 @@ public final class Server {
List<AsyncProcessor> asyncProcessors = new ArrayList<>(); 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()) { if (options.getSendDeviceMeta()) {
connection.sendDeviceMeta(Device.getDeviceName()); connection.sendDeviceMeta(Device.getDeviceName());
} }
@ -150,6 +151,8 @@ public final class Server {
} catch (InterruptedException e) { } catch (InterruptedException e) {
// ignore // ignore
} }
connection.close();
} }
} }