Don't set TCP_NODELAY on a UDP socket
This was preventing DTLS connections from being made from the command line.
@@ -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;
