From d4f132e9609745e345c90835ab2d403f8629ba03 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Tue, 24 Jun 2014 17:30:00 +0000 Subject: Actually make BIO_set_tcp_ndelay() work - TCP_NODELAY will not magically appear by itself. ok beck@ miod@ --- src/lib/libcrypto/bio/b_sock.c | 19 +++---------------- src/lib/libssl/src/crypto/bio/b_sock.c | 19 +++---------------- 2 files changed, 6 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index ec28ba2e82..62d545a129 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b_sock.c,v 1.41 2014/06/22 16:47:08 jsing Exp $ */ +/* $OpenBSD: b_sock.c,v 1.42 2014/06/24 17:30:00 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -60,6 +60,7 @@ #include #include +#include #include #include @@ -509,21 +510,7 @@ end: int BIO_set_tcp_ndelay(int s, int on) { - int ret = 0; -#if defined(TCP_NODELAY) && (defined(IPPROTO_TCP) || defined(SOL_TCP)) - int opt; - -#ifdef SOL_TCP - opt = SOL_TCP; -#else -#ifdef IPPROTO_TCP - opt = IPPROTO_TCP; -#endif -#endif - - ret = setsockopt(s, opt, TCP_NODELAY, (char *)&on, sizeof(on)); -#endif - return (ret == 0); + return (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) == 0); } int diff --git a/src/lib/libssl/src/crypto/bio/b_sock.c b/src/lib/libssl/src/crypto/bio/b_sock.c index ec28ba2e82..62d545a129 100644 --- a/src/lib/libssl/src/crypto/bio/b_sock.c +++ b/src/lib/libssl/src/crypto/bio/b_sock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b_sock.c,v 1.41 2014/06/22 16:47:08 jsing Exp $ */ +/* $OpenBSD: b_sock.c,v 1.42 2014/06/24 17:30:00 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -60,6 +60,7 @@ #include #include +#include #include #include @@ -509,21 +510,7 @@ end: int BIO_set_tcp_ndelay(int s, int on) { - int ret = 0; -#if defined(TCP_NODELAY) && (defined(IPPROTO_TCP) || defined(SOL_TCP)) - int opt; - -#ifdef SOL_TCP - opt = SOL_TCP; -#else -#ifdef IPPROTO_TCP - opt = IPPROTO_TCP; -#endif -#endif - - ret = setsockopt(s, opt, TCP_NODELAY, (char *)&on, sizeof(on)); -#endif - return (ret == 0); + return (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) == 0); } int -- cgit v1.2.3-55-g6feb