From 5eaf775dae9245dddf159e8ecb087bfa23cfac57 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Tue, 9 Mar 1999 17:31:42 +0000 Subject: [PATCH] Fix broken _convert_sockopt for IPPROTO_TCP cases, added TCP_NODELAY. --- include/winsock.h | 3 +++ misc/winsock.c | 23 +++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/include/winsock.h b/include/winsock.h index 84f015378c4..852745d786a 100644 --- a/include/winsock.h +++ b/include/winsock.h @@ -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) */ diff --git a/misc/winsock.c b/misc/winsock.c index 575a836353e..e1c838b21d9 100644 --- a/misc/winsock.c +++ b/misc/winsock.c @@ -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; } }