Close socket on error
Suggested-by: barry-ran <https://github.com/Genymobile/scrcpy/issues/607>
This commit is contained in:
parent
bfb3f0842f
commit
91ecb4f218
1 changed files with 1 additions and 0 deletions
|
@ -155,6 +155,7 @@ connect_and_read_byte(uint16_t port) {
|
||||||
// is not listening, so read one byte to detect a working connection
|
// is not listening, so read one byte to detect a working connection
|
||||||
if (net_recv(socket, &byte, 1) != 1) {
|
if (net_recv(socket, &byte, 1) != 1) {
|
||||||
// the server is not listening yet behind the adb tunnel
|
// the server is not listening yet behind the adb tunnel
|
||||||
|
net_close(socket);
|
||||||
return INVALID_SOCKET;
|
return INVALID_SOCKET;
|
||||||
}
|
}
|
||||||
return socket;
|
return socket;
|
||||||
|
|
Loading…
Reference in a new issue