diff options
author | mouring <mouring> | 2002-02-26 18:12:51 +0000 |
---|---|---|
committer | mouring <mouring> | 2002-02-26 18:12:51 +0000 |
commit | bf5480b54c43f4126cc85e515cbdae1e8777d1f1 (patch) | |
tree | 869fba98dd73f9212b6884cb86c745abc6766a45 /misc.c | |
parent | 634f2da6c2ca695220717d21f39a5cb59fd07ab1 (diff) | |
download | openssh-bf5480b54c43f4126cc85e515cbdae1e8777d1f1.tar.gz |
- stevesk@cvs.openbsd.org 2002/02/24 19:59:42
[channels.c misc.c]
disable Nagle in connect_to() and channel_post_port_listener() (port
forwarding endpoints). the intention is to preserve the on-the-wire
appearance to applications at either end; the applications can then
enable TCP_NODELAY according to their requirements. ok markus@
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.15 2002/01/24 21:09:25 stevesk Exp $ */ +/* $OpenBSD: misc.c,v 1.16 2002/02/24 19:59:42 stevesk Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. @@ -25,7 +25,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: misc.c,v 1.15 2002/01/24 21:09:25 stevesk Exp $"); +RCSID("$OpenBSD: misc.c,v 1.16 2002/02/24 19:59:42 stevesk Exp $"); #include "misc.h" #include "log.h" @@ -96,10 +96,20 @@ unset_nonblock(int fd) void set_nodelay(int fd) { - int on = 1; + int opt, optlen; + optlen = sizeof opt; + if (getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, &optlen) == -1) { + error("getsockopt TCP_NODELAY: %.100s", strerror(errno)); + return; + } + if (opt == 1) { + debug2("fd %d is TCP_NODELAY", fd); + return; + } + opt = 1; debug("fd %d setting TCP_NODELAY", fd); - if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on) == -1) + if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof opt) == -1) error("setsockopt TCP_NODELAY: %.100s", strerror(errno)); } |