Fix broken _convert_sockopt for IPPROTO_TCP cases, added TCP_NODELAY.

This commit is contained in:
Marcus Meissner 1999-03-09 17:31:42 +00:00 committed by Alexandre Julliard
parent 2503e7e4c7
commit 5eaf775dae
2 changed files with 24 additions and 2 deletions

View File

@ -220,6 +220,9 @@ typedef struct WSAData {
#define WS_IOR(x,y,t) (WS_IOC_OUT|(((UINT)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
#define WS_IOW(x,y,t) (WS_IOC_IN|(((UINT)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
/* IPPROTO_TCP options */
#define WS_TCP_NODELAY 1 /* do not apply nagle algorithm */
/*
* Socket I/O flags (supported by spec 1.1)
*/

View File

@ -98,6 +98,20 @@ static int _px_sock_ops[] =
SO_LINGER, SO_OOBINLINE, SO_SNDBUF, SO_RCVBUF, SO_ERROR, SO_TYPE,
SO_LINGER };
static INT _ws_tcp_ops[] = {
#ifdef TCP_NODELAY
WS_TCP_NODELAY,
#endif
0
};
static int _px_tcp_ops[] = {
#ifdef TCP_NODELAY
TCP_NODELAY,
#endif
0
};
static int _check_ws(LPWSINFO pwsi, ws_socket* pws);
static char* _check_buffer(LPWSINFO pwsi, int size);
@ -116,10 +130,15 @@ static void convert_sockopt(INT *level, INT *optname)
for(i=0; _ws_sock_ops[i]; i++)
if( _ws_sock_ops[i] == *optname ) break;
if( _ws_sock_ops[i] ) *optname = _px_sock_ops[i];
else WARN(winsock, "Unknown optname %d\n", *optname);
else FIXME(winsock, "Unknown SOL_SOCKET optname %d\n", *optname);
break;
case WS_IPPROTO_TCP:
*optname = IPPROTO_TCP;
*level = IPPROTO_TCP;
for(i=0; _ws_tcp_ops[i]; i++)
if ( _ws_tcp_ops[i] == *optname ) break;
if( _ws_tcp_ops[i] ) *optname = _px_tcp_ops[i];
else FIXME(winsock, "Unknown IPPROTO_TCP optname %d\n", *optname);
break;
}
}