Don't set TCP_NODELAY on a UDP socket
authorMatt Caswell <matt@openssl.org>
Wed, 2 May 2018 15:08:27 +0000 (16:08 +0100)
committerMatt Caswell <matt@openssl.org>
Fri, 11 May 2018 13:20:57 +0000 (14:20 +0100)
This was preventing DTLS connections from being made from the command line.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6159)

apps/s_socket.c

index 69f0f4f..d16108c 100644 (file)
@@ -146,7 +146,8 @@ int init_client(int *sock, const char *host, const char *port,
         }
 #endif
 
-        if (!BIO_connect(*sock, BIO_ADDRINFO_address(ai), BIO_SOCK_NODELAY)) {
+        if (!BIO_connect(*sock, BIO_ADDRINFO_address(ai),
+                         type == SOCK_STREAM ? BIO_SOCK_NODELAY : 0)) {
             BIO_closesocket(*sock);
             *sock = INVALID_SOCKET;
             continue;