diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-09-24 10:44:40 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-09-24 10:44:40 +0000 |
commit | f6039c4aedd2b0c996141510596d2c0b9b24832b (patch) | |
tree | a5ac0936a338630a53203ffdfbcd147986061509 /usr.sbin | |
parent | b3e758366d842b5234c71705a25d5bcfd4729f7c (diff) |
Set TCP_NODELAY since we want the request to be sent ASAP.
OK dlg@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/iscsid/connection.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/iscsid/connection.c b/usr.sbin/iscsid/connection.c index 3bf6bb653be..ca03d93f513 100644 --- a/usr.sbin/iscsid/connection.c +++ b/usr.sbin/iscsid/connection.c @@ -1,4 +1,4 @@ -/* $OpenBSD: connection.c,v 1.1 2010/09/24 09:43:19 claudio Exp $ */ +/* $OpenBSD: connection.c,v 1.2 2010/09/24 10:44:39 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org> @@ -23,6 +23,7 @@ #include <sys/uio.h> #include <netinet/in.h> +#include <netinet/tcp.h> #include <scsi/iscsi.h> #include <scsi/scsi_all.h> @@ -53,6 +54,7 @@ void conn_new(struct session *s, struct connection_config *cc) { struct connection *c; + int nodelay = 1; if (!(c = calloc(1, sizeof(*c)))) fatal("session_add_conn"); @@ -85,6 +87,13 @@ conn_new(struct session *s, struct connection_config *cc) return; } + /* try to turn off TCP Nagle */ + if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY, &nodelay, + sizeof(nodelay)) == -1) + log_warn("conn_new: setting TCP_NODELAY"); + + + event_set(&c->ev, c->fd, EV_READ|EV_PERSIST, conn_dispatch, c); event_set(&c->wev, c->fd, EV_WRITE, conn_write_dispatch, c); event_add(&c->ev, NULL); |