Immediately close the server socket on the device

In "adb forward" mode, close the server socket as soon as the client is
connected.

Even if unlikely to be useful, it allows to run several instances of
scrcpy also in "adb forward" mode.
pull/85/head
Romain Vimont 6 years ago
parent 0b1e59186f
commit c530d95881

@ -36,7 +36,11 @@ public final class DesktopConnection implements Closeable {
private static LocalSocket listenAndAccept(String abstractName) throws IOException {
LocalServerSocket localServerSocket = new LocalServerSocket(abstractName);
return localServerSocket.accept();
try {
return localServerSocket.accept();
} finally {
localServerSocket.close();
}
}
public static DesktopConnection open(Device device, boolean tunnelForward) throws IOException {

Loading…
Cancel
Save