fix bugs on socket timeout tv usec calculation

This commit is contained in:
Minun Dragonation 2019-05-05 21:58:34 +08:00
parent 4a94ce6326
commit f5454d509f

View File

@ -197,7 +197,7 @@ int win32_getsockopt(SOCKET sockfd, int level, int optname, void *optval, sockle
socklen_t dwlen = 0; socklen_t dwlen = 0;
ret = getsockopt(sockfd, level, optname, (char *)&timeout, &dwlen); ret = getsockopt(sockfd, level, optname, (char *)&timeout, &dwlen);
tv->tv_sec = timeout / 1000; tv->tv_sec = timeout / 1000;
tv->tv_usec = timeout * 1000; tv->tv_usec = (timeout * 1000) % 1000000;
} else { } else {
ret = WSAEFAULT; ret = WSAEFAULT;
} }