apps/s_socket.c: disable the Nagle algorithm.
authorAndy Polyakov <appro@openssl.org>
Thu, 5 Apr 2018 16:59:36 +0000 (18:59 +0200)
committerAndy Polyakov <appro@openssl.org>
Sun, 8 Apr 2018 09:42:30 +0000 (11:42 +0200)
Without TCP_NODELAY alerts risk to be dropped between shutdown and close.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5887)

apps/s_socket.c

index e3cfda98ae73e0ad6af86e863e5cdb1cc266dcae..80b63ebc4d01d5527304d273f0f1ef37489fd292 100644 (file)
@@ -146,7 +146,7 @@ int init_client(int *sock, const char *host, const char *port,
         }
 #endif
 
-        if (!BIO_connect(*sock, BIO_ADDRINFO_address(ai), 0)) {
+        if (!BIO_connect(*sock, BIO_ADDRINFO_address(ai), BIO_SOCK_NODELAY)) {
             BIO_closesocket(*sock);
             *sock = INVALID_SOCKET;
             continue;
@@ -330,6 +330,7 @@ int do_server(int *accept_sock, const char *host, const char *port,
                 BIO_closesocket(asock);
                 break;
             }
+            BIO_set_tcp_ndelay(sock, 1);
             i = (*cb)(sock, type, protocol, context);
 
             /*