diff options
author | Kevin Steves <stevesk@cvs.openbsd.org> | 2002-01-24 21:09:26 +0000 |
---|---|---|
committer | Kevin Steves <stevesk@cvs.openbsd.org> | 2002-01-24 21:09:26 +0000 |
commit | d98b6e77939d264b72d7ba611fa6f6e05506a0c6 (patch) | |
tree | a616e6b4c58f057d851f4320bf265e264501c572 /usr.bin/ssh/misc.c | |
parent | 3c3961099eef800c92caf7178190a3133c5562f2 (diff) |
add set_nodelay() to set TCP_NODELAY on a socket (prep for nagle tuning).
no nagle changes just yet; ok djm@ markus@
Diffstat (limited to 'usr.bin/ssh/misc.c')
-rw-r--r-- | usr.bin/ssh/misc.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c index 9fffc10a6f3..a5447b4dacd 100644 --- a/usr.bin/ssh/misc.c +++ b/usr.bin/ssh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.14 2001/12/19 07:18:56 deraadt Exp $ */ +/* $OpenBSD: misc.c,v 1.15 2002/01/24 21:09:25 stevesk Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. @@ -25,7 +25,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: misc.c,v 1.14 2001/12/19 07:18:56 deraadt Exp $"); +RCSID("$OpenBSD: misc.c,v 1.15 2002/01/24 21:09:25 stevesk Exp $"); #include "misc.h" #include "log.h" @@ -92,6 +92,17 @@ unset_nonblock(int fd) fd, strerror(errno)); } +/* disable nagle on socket */ +void +set_nodelay(int fd) +{ + int on = 1; + + debug("fd %d setting TCP_NODELAY", fd); + if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on) == -1) + error("setsockopt TCP_NODELAY: %.100s", strerror(errno)); +} + /* Characters considered whitespace in strsep calls. */ #define WHITESPACE " \t\r\n" |