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.
This commit is contained in:
parent
0b1e59186f
commit
c530d95881
1 changed files with 5 additions and 1 deletions
|
@ -36,7 +36,11 @@ public final class DesktopConnection implements Closeable {
|
||||||
|
|
||||||
private static LocalSocket listenAndAccept(String abstractName) throws IOException {
|
private static LocalSocket listenAndAccept(String abstractName) throws IOException {
|
||||||
LocalServerSocket localServerSocket = new LocalServerSocket(abstractName);
|
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 {
|
public static DesktopConnection open(Device device, boolean tunnelForward) throws IOException {
|
||||||
|
|
Loading…
Reference in a new issue