mirror of
https://github.com/Genymobile/scrcpy
synced 2024-12-20 14:22:26 +00:00
Replace try-with-resources
LocalServerSocket was not AutoCloseable in older Android SDKs.
This commit is contained in:
parent
cfc9882897
commit
f996386b6e
@ -68,7 +68,8 @@ public final class DesktopConnection implements Closeable {
|
||||
LocalSocket controlSocket = null;
|
||||
try {
|
||||
if (tunnelForward) {
|
||||
try (LocalServerSocket localServerSocket = new LocalServerSocket(socketName)) {
|
||||
LocalServerSocket localServerSocket = new LocalServerSocket(socketName);
|
||||
try {
|
||||
videoSocket = localServerSocket.accept();
|
||||
if (sendDummyByte) {
|
||||
// send one byte so the client may read() to detect a connection error
|
||||
@ -80,6 +81,8 @@ public final class DesktopConnection implements Closeable {
|
||||
if (control) {
|
||||
controlSocket = localServerSocket.accept();
|
||||
}
|
||||
} finally {
|
||||
localServerSocket.close();
|
||||
}
|
||||
} else {
|
||||
videoSocket = connect(socketName);
|
||||
|
Loading…
Reference in New Issue
Block a user