Commit 6cea48b9 authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

ws2_32: Support indefinite receive timeouts.

parent 70890031
......@@ -3303,7 +3303,7 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
tval.tv_usec = (*(const UINT32*)optval % 1000) * 1000;
tval.tv_sec = *(const UINT32*)optval / 1000;
/* min of 500 milliseconds */
if (tval.tv_sec == 0 && tval.tv_usec < 500000)
if (tval.tv_sec == 0 && tval.tv_usec && tval.tv_usec < 500000)
tval.tv_usec = 500000;
optlen = sizeof(struct timeval);
optval = (char*)&tval;
......
......@@ -986,6 +986,15 @@ static void test_set_getsockopt(void)
err = getsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (char *) &timeout, &size);
ok( !err, "get/setsockopt(SO_RCVTIMEO) failed error: %d\n", WSAGetLastError());
ok( timeout == SOCKTIMEOUT1, "getsockopt(SO_RCVTIMEO) returned wrong value %d\n", timeout);
timeout = 0;
size = sizeof(timeout);
err = setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (char *) &timeout, size);
if( !err)
err = getsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (char *) &timeout, &size);
ok( !err, "get/setsockopt(SO_RCVTIMEO) failed error: %d\n", WSAGetLastError());
ok( timeout == 0, "getsockopt(SO_RCVTIMEO) returned wrong value %d\n", timeout);
/* SO_SNDTIMEO */
timeout = SOCKTIMEOUT2; /* 997 seconds. See remark above */
size = sizeof(timeout);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment