androiddump: Set connect socket to non-blocking on Windows

Bug: 13104
Change-Id: I05248dad8e72272cf0933c766ec0bf5160075e1e
Reviewed-on: https://code.wireshark.org/review/20275
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2017-02-25 20:49:43 -05:00
parent 3cc899a428
commit 043ed1f6b3
1 changed files with 4 additions and 0 deletions

View File

@ -279,9 +279,13 @@ static void useNonBlockingConnectTimeout(socket_handle_t sock) {
int res_rcv;
#ifdef _WIN32
const DWORD socket_timeout = SOCKET_RW_TIMEOUT_MS;
unsigned long non_blocking = 1;
res_snd = setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const char *) &socket_timeout, sizeof(socket_timeout));
res_rcv = setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char *) &socket_timeout, sizeof(socket_timeout));
/* set socket to non-blocking */
ioctlsocket(sock, FIONBIO, &non_blocking);
#else
const struct timeval socket_timeout = {
.tv_sec = SOCKET_RW_TIMEOUT_MS / 1000,