androiddump: Have a timeout with non-blocking sockets on Windows too

After ae9da806947f66d2ea8bf77ca9c2ccdcd89f5483 androiddump properly
checks to see if sockets timeout on Windows (recv doesn't set errno
on Windows), so we can use a timeout instead of stalling.

Fix #20526
This commit is contained in:
John Thacker 2025-06-17 16:23:39 -04:00 committed by AndersBroman
parent b7060b5125
commit 0396917654

View File

@ -394,8 +394,6 @@ static void useSndTimeout(socket_handle_t sock) {
static void useNonBlockingConnectTimeout(socket_handle_t sock) { static void useNonBlockingConnectTimeout(socket_handle_t sock) {
#ifdef _WIN32 #ifdef _WIN32
/* On Windows, we set a timeout for the non-blocking connection
* and have no timeout on the blocking connection. */
int res_snd; int res_snd;
int res_rcv; int res_rcv;
const DWORD socket_timeout = SOCKET_RW_TIMEOUT_MS; const DWORD socket_timeout = SOCKET_RW_TIMEOUT_MS;
@ -420,11 +418,7 @@ static void useNormalConnectTimeout(socket_handle_t sock) {
int res_snd; int res_snd;
int res_rcv; int res_rcv;
#ifdef _WIN32 #ifdef _WIN32
/* On Windows there is no timeout on the blocking connection, which const DWORD socket_timeout = SOCKET_RW_TIMEOUT_MS;
* means that the error handling from recv(), etc. is different than
* on UN*X. (If the socket timeout on Windows were the same as UN*X,
* we would need to test WSAGetLastError() in a number of places.) */
const DWORD socket_timeout = 0;
unsigned long non_blocking = 0; unsigned long non_blocking = 0;
res_snd = setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const char *) &socket_timeout, sizeof(socket_timeout)); res_snd = setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const char *) &socket_timeout, sizeof(socket_timeout));