- stevesk@cvs.openbsd.org 2002/01/24 21:09:25
     [channels.c misc.c misc.h packet.c]
     add set_nodelay() to set TCP_NODELAY on a socket (prep for nagle tuning).
     no nagle changes just yet; ok djm@ markus@
This commit is contained in:
Damien Miller 2002-02-05 11:52:13 +11:00
Родитель 1e2c600892
Коммит 398e1cfa23
5 изменённых файлов: 31 добавлений и 18 удалений

Просмотреть файл

@ -1,3 +1,11 @@
20020205
- (djm) OpenBSD CVS Sync
- stevesk@cvs.openbsd.org 2002/01/24 21:09:25
[channels.c misc.c misc.h packet.c]
add set_nodelay() to set TCP_NODELAY on a socket (prep for nagle tuning).
no nagle changes just yet; ok djm@ markus@
20020130
- (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@
- (tim) [configure.ac] fix logic on when ssh-rand-helper is installed.
@ -7399,4 +7407,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
$Id: ChangeLog,v 1.1798 2002/01/31 06:14:03 tim Exp $
$Id: ChangeLog,v 1.1799 2002/02/05 00:52:13 djm Exp $

Просмотреть файл

@ -39,7 +39,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: channels.c,v 1.161 2002/01/21 23:27:10 markus Exp $");
RCSID("$OpenBSD: channels.c,v 1.162 2002/01/24 21:09:25 stevesk Exp $");
#include "ssh.h"
#include "ssh1.h"
@ -986,7 +986,7 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
{
Channel *nc;
struct sockaddr addr;
int newsock, on = 1;
int newsock;
socklen_t addrlen;
char buf[16384], *remote_ipaddr;
int remote_port;
@ -1004,10 +1004,7 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
error("accept: %.100s", strerror(errno));
return;
}
if (setsockopt(newsock, IPPROTO_TCP, TCP_NODELAY, &on,
sizeof on) == -1)
error("setsockopt TCP_NODELAY: %.100s",
strerror(errno));
set_nodelay(newsock);
remote_ipaddr = get_peer_ipaddr(newsock);
remote_port = get_peer_port(newsock);
snprintf(buf, sizeof buf, "X11 connection from %.200s port %d",
@ -2495,7 +2492,7 @@ connect_local_xsocket(u_int dnr)
int
x11_connect_display(void)
{
int display_number, sock = 0, on = 1;
int display_number, sock = 0;
const char *display;
char buf[1024], *cp;
struct addrinfo hints, *ai, *aitop;
@ -2583,8 +2580,7 @@ x11_connect_display(void)
strerror(errno));
return -1;
}
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on) == -1)
error("setsockopt TCP_NODELAY: %.100s", strerror(errno));
set_nodelay(sock);
return sock;
}

15
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"

3
misc.h
Просмотреть файл

@ -1,4 +1,4 @@
/* $OpenBSD: misc.h,v 1.10 2001/06/26 17:27:24 markus Exp $ */
/* $OpenBSD: misc.h,v 1.11 2002/01/24 21:09:25 stevesk Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -16,6 +16,7 @@ char *chop(char *);
char *strdelim(char **);
void set_nonblock(int);
void unset_nonblock(int);
void set_nodelay(int);
int a2port(const char *);
char *cleanhostname(char *);
char *colon(char *);

Просмотреть файл

@ -37,7 +37,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: packet.c,v 1.85 2002/01/18 18:14:17 stevesk Exp $");
RCSID("$OpenBSD: packet.c,v 1.86 2002/01/24 21:09:25 stevesk Exp $");
#include "xmalloc.h"
#include "buffer.h"
@ -1191,7 +1191,6 @@ packet_set_interactive(int interactive)
int lowdelay = IPTOS_LOWDELAY;
int throughput = IPTOS_THROUGHPUT;
#endif
int on = 1;
if (called)
return;
@ -1219,9 +1218,7 @@ packet_set_interactive(int interactive)
strerror(errno));
}
#endif
if (setsockopt(connection_in, IPPROTO_TCP, TCP_NODELAY, (void *) &on,
sizeof(on)) < 0)
error("setsockopt TCP_NODELAY: %.100s", strerror(errno));
set_nodelay(connection_in);
} else if (packet_connection_is_ipv4()) {
/*
* Set IP options for a non-interactive connection. Use