Made WINSOCK_setsockopt handle option SO_DONTLINGER correctly.
This commit is contained in:
parent
15f86464c0
commit
20c68be907
|
@ -1638,6 +1638,13 @@ INT WINAPI WINSOCK_setsockopt(SOCKET16 s, INT level, INT optname,
|
||||||
struct linger linger;
|
struct linger linger;
|
||||||
int fd = _get_sock_fd(s);
|
int fd = _get_sock_fd(s);
|
||||||
|
|
||||||
|
if(optname == WS_SO_DONTLINGER) {
|
||||||
|
linger.l_onoff = *((int*)optval) ? 0: 1;
|
||||||
|
linger.l_linger = 0;
|
||||||
|
optname=SO_LINGER;
|
||||||
|
optval = (char*)&linger;
|
||||||
|
optlen = sizeof(struct linger);
|
||||||
|
}else{
|
||||||
convert_sockopt(&level, &optname);
|
convert_sockopt(&level, &optname);
|
||||||
if (optname == SO_LINGER && optval) {
|
if (optname == SO_LINGER && optval) {
|
||||||
/* yes, uses unsigned short in both win16/win32 */
|
/* yes, uses unsigned short in both win16/win32 */
|
||||||
|
@ -1648,6 +1655,7 @@ INT WINAPI WINSOCK_setsockopt(SOCKET16 s, INT level, INT optname,
|
||||||
optval = (char*)&linger;
|
optval = (char*)&linger;
|
||||||
optlen = sizeof(struct linger);
|
optlen = sizeof(struct linger);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (setsockopt(fd, level, optname, optval, optlen) == 0)
|
if (setsockopt(fd, level, optname, optval, optlen) == 0)
|
||||||
{
|
{
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
Loading…
Reference in New Issue