From 752c0ad396537428bce348009f17f2a87ff600fc Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Fri, 7 Dec 2012 14:50:58 +0100 Subject: [PATCH] SOCKET set TCP_NODELAY on iscsi->fd This will set TCP_NODELAY on the socket connection to the target. This is the first step to improve latency. For systems supporting TCP_CORK we plan to add a cork around certain PDUs e.g. DATA-Out, but this needs further testing. Signed-off-by: Peter Lieven --- lib/socket.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/socket.c b/lib/socket.c index c7f9c4f..6812b90 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -283,6 +283,12 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal, } #endif + if (set_tcp_sockopt(iscsi->fd, TCP_NODELAY, 1) != 0) { + ISCSI_LOG(iscsi,1,"failed to set TCP_NODELAY sockopt: %s",strerror(errno)); + } else { + ISCSI_LOG(iscsi,3,"TCP_NODELAY set to 1"); + } + if (connect(iscsi->fd, ai->ai_addr, socksize) != 0 && errno != EINPROGRESS) { iscsi_set_error(iscsi, "Connect failed with errno : "