Set TCP_NODELAY to avoid big latency between sending data-in and sending
command response on reads, and to make sure the response goes out
promptly for completed writes.

Signed-off-by: Pete Wyckoff <[EMAIL PROTECTED]>
---
 usr/iscsi/iscsi_tcp.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/usr/iscsi/iscsi_tcp.c b/usr/iscsi/iscsi_tcp.c
index c4d08a1..09ed0e5 100644
--- a/usr/iscsi/iscsi_tcp.c
+++ b/usr/iscsi/iscsi_tcp.c
@@ -78,6 +78,15 @@ static int set_keepalive(int fd)
        return 0;
 }
 
+static int set_nodelay(int fd)
+{
+       int ret, opt;
+
+       opt = 1;
+       ret = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
+       return ret;
+}
+
 static void accept_connection(int afd, int events, void *data)
 {
        struct sockaddr_storage from;
@@ -99,6 +108,10 @@ static void accept_connection(int afd, int events, void 
*data)
        if (ret)
                goto out;
 
+       ret = set_nodelay(fd);
+       if (ret)
+               goto out;
+
        tcp_conn = zalloc(sizeof(*tcp_conn));
        if (!tcp_conn)
                goto out;
-- 
1.5.3.8

_______________________________________________
Stgt-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/stgt-devel

Reply via email to