mirror of
https://github.com/lammertb/libhttp.git
synced 2025-12-22 04:02:04 +03:00
Fix copy-paste error in set_sock_timeout
This commit is contained in:
@@ -10054,11 +10054,11 @@ set_sock_timeout(SOCKET sock, int milliseconds)
|
|||||||
#if defined(TCP_USER_TIMEOUT)
|
#if defined(TCP_USER_TIMEOUT)
|
||||||
unsigned int uto = (unsigned int)milliseconds;
|
unsigned int uto = (unsigned int)milliseconds;
|
||||||
#endif
|
#endif
|
||||||
struct timeval t;
|
struct timeval tv;
|
||||||
|
|
||||||
memset(&tv, 0, sizeof(tv));
|
memset(&tv, 0, sizeof(tv));
|
||||||
t.tv_sec = milliseconds / 1000;
|
tv.tv_sec = milliseconds / 1000;
|
||||||
t.tv_usec = (milliseconds * 1000) % 1000000;
|
tv.tv_usec = (milliseconds * 1000) % 1000000;
|
||||||
|
|
||||||
/* TCP_USER_TIMEOUT/RFC5482 (http://tools.ietf.org/html/rfc5482):
|
/* TCP_USER_TIMEOUT/RFC5482 (http://tools.ietf.org/html/rfc5482):
|
||||||
* max. time waiting for the acknowledged of TCP data before the connection
|
* max. time waiting for the acknowledged of TCP data before the connection
|
||||||
@@ -10073,10 +10073,10 @@ set_sock_timeout(SOCKET sock, int milliseconds)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
r1 =
|
r1 = setsockopt(
|
||||||
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (SOCK_OPT_TYPE)&t, sizeof(t));
|
sock, SOL_SOCKET, SO_RCVTIMEO, (SOCK_OPT_TYPE)&tv, sizeof(tv));
|
||||||
r2 =
|
r2 = setsockopt(
|
||||||
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (SOCK_OPT_TYPE)&t, sizeof(t));
|
sock, SOL_SOCKET, SO_SNDTIMEO, (SOCK_OPT_TYPE)&tv, sizeof(tv));
|
||||||
|
|
||||||
return r1 || r2;
|
return r1 || r2;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user