fix bugs on ref address incorrect on sockcompact with getsockopt

This commit is contained in:
Minun Dragonation 2019-05-05 21:39:46 +08:00
parent d8f814d48b
commit 82252440de

View File

@ -192,9 +192,8 @@ int win32_getsockopt(SOCKET sockfd, int level, int optname, void *optval, sockle
int ret = 0; int ret = 0;
if ((level == SOL_SOCKET) && ((optname == SO_RCVTIMEO) || (optname == SO_SNDTIMEO))) { if ((level == SOL_SOCKET) && ((optname == SO_RCVTIMEO) || (optname == SO_SNDTIMEO))) {
struct timeval *tv = (struct timeval *)optval; struct timeval *tv = (struct timeval *)optval;
DWORD timeout = 0; DWORD timeout = 0; 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;
*optlen = sizeof (struct timeval); *optlen = sizeof (struct timeval);