diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2002-02-26 18:12:51 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2002-02-26 18:12:51 +0000 |
commit | 1ebd7a5342a91f8aaa3eabd6c86c7afe8d663cd6 (patch) | |
tree | 661c0e5ccf8ce7a9b599430d3e160eaa937916ee /misc.c | |
parent | 90fd814f90a5733584d8c2d877924469ac39d819 (diff) |
- 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 @@ | |||
1 | /* $OpenBSD: misc.c,v 1.15 2002/01/24 21:09:25 stevesk Exp $ */ | 1 | /* $OpenBSD: misc.c,v 1.16 2002/02/24 19:59:42 stevesk Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "includes.h" | 27 | #include "includes.h" |
28 | RCSID("$OpenBSD: misc.c,v 1.15 2002/01/24 21:09:25 stevesk Exp $"); | 28 | RCSID("$OpenBSD: misc.c,v 1.16 2002/02/24 19:59:42 stevesk Exp $"); |
29 | 29 | ||
30 | #include "misc.h" | 30 | #include "misc.h" |
31 | #include "log.h" | 31 | #include "log.h" |
@@ -96,10 +96,20 @@ unset_nonblock(int fd) | |||
96 | void | 96 | void |
97 | set_nodelay(int fd) | 97 | set_nodelay(int fd) |
98 | { | 98 | { |
99 | int on = 1; | 99 | int opt, optlen; |
100 | 100 | ||
101 | optlen = sizeof opt; | ||
102 | if (getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, &optlen) == -1) { | ||
103 | error("getsockopt TCP_NODELAY: %.100s", strerror(errno)); | ||
104 | return; | ||
105 | } | ||
106 | if (opt == 1) { | ||
107 | debug2("fd %d is TCP_NODELAY", fd); | ||
108 | return; | ||
109 | } | ||
110 | opt = 1; | ||
101 | debug("fd %d setting TCP_NODELAY", fd); | 111 | debug("fd %d setting TCP_NODELAY", fd); |
102 | if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on) == -1) | 112 | if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof opt) == -1) |
103 | error("setsockopt TCP_NODELAY: %.100s", strerror(errno)); | 113 | error("setsockopt TCP_NODELAY: %.100s", strerror(errno)); |
104 | } | 114 | } |
105 | 115 | ||