Enable close-on-interrupt for macOS

This behavior is also necessary on macOS.

Fixes #5536 <https://github.com/Genymobile/scrcpy/issues/5536>
This commit is contained in:
Romain Vimont 2024-11-27 10:10:18 +01:00
parent ff06b6dcc1
commit d01373c03c

View File

@ -16,10 +16,10 @@
# define SC_RAW_SOCKET_NONE -1 # define SC_RAW_SOCKET_NONE -1
#endif #endif
#ifdef _WIN32 #if defined(_WIN32) || defined(__APPLE__)
// On Windows, shutdown() does not interrupt accept() or read() calls, so // On Windows and macOS, shutdown() does not interrupt accept() or read()
// net_interrupt() must call close() instead, and net_close() must behave // calls, so net_interrupt() must call close() instead, and net_close() must
// accordingly. // behave accordingly.
// This causes a small race condition (once the socket is closed, its // This causes a small race condition (once the socket is closed, its
// handle becomes invalid and may in theory be reassigned before another // handle becomes invalid and may in theory be reassigned before another
// thread calls accept() or read()), but it is deemed acceptable as a // thread calls accept() or read()), but it is deemed acceptable as a