1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 20:12:48 -05:00

Add a configuration option for TCP keepalives (SO_KEEPALIVE), default off.

No very good reason, but I've occasionally wanted to frob it to see if it
makes any difference to problems I'm having, and it was easy.

Tested that it does actually cause keepalives on Windows (with tcpdump);
should also work on Unix. Not implemented on Mac (does nothing), but then
neither is TCP_NODELAY.

Quite a big checkin, much of which is adding `keepalive' alongside `nodelay'
in network function calls.

[originally from svn r4309]
This commit is contained in:
Jacob Nevins
2004-06-20 17:07:38 +00:00
parent 6bcac21e36
commit 20f433efac
29 changed files with 109 additions and 51 deletions

View File

@ -12,7 +12,7 @@ struct macnet_stack {
void (*addrcopy)(SockAddr, char *);
void (*addr_free)(SockAddr);
Socket (*skregister)(void *, Plug); /* "register" is a reserved word */
Socket (*new)(SockAddr, int, int, int, int, Plug);
Socket (*new)(SockAddr, int, int, int, int, int, Plug);
Socket (*newlistener)(char *, int, Plug, int);
char *(*addr_error)(SockAddr);
void (*poll)(void);
@ -128,11 +128,12 @@ Socket sk_register(void *sock, Plug plug)
}
Socket sk_new(SockAddr addr, int port, int privport, int oobinline,
int nodelay, Plug plug)
int nodelay, int keepalive, Plug plug)
{
if (stack != NULL)
return stack->new(addr, port, privport, oobinline, nodelay, plug);
return stack->new(addr, port, privport, oobinline, nodelay, keepalive,
plug);
return NULL;
}

View File

@ -1,4 +1,4 @@
/* $Id: macterm.c,v 1.75 2003/05/04 14:18:18 simon Exp $ */
/* $Id: macterm.c,v 1.76 2004/06/20 17:07:37 jacob Exp $ */
/*
* Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999, 2002 Ben Harris
@ -158,7 +158,8 @@ void mac_startsession(Session *s)
term_provide_logctx(s->term, s->logctx);
errmsg = s->back->init(s, &s->backhandle, &s->cfg, s->cfg.host,
s->cfg.port, &s->realhost, s->cfg.tcp_nodelay);
s->cfg.port, &s->realhost, s->cfg.tcp_nodelay,
s->cfg.tcp_keepalives);
if (errmsg != NULL)
fatalbox("%s", errmsg);
s->back->provide_logctx(s->backhandle, s->logctx);

View File

@ -410,7 +410,7 @@ Socket mactcp_register(void *sock, Plug plug)
static TCPNotifyUPP mactcp_asr_upp;
Socket mactcp_new(SockAddr addr, int port, int privport, int oobinline,
int nodelay, Plug plug)
int nodelay, int keepalive, Plug plug)
{
static struct socket_function_table fn_table = {
mactcp_plug,

View File

@ -234,7 +234,7 @@ Socket ot_register(void *sock, Plug plug)
}
Socket ot_new(SockAddr addr, int port, int privport, int oobinline,
int nodelay, Plug plug)
int nodelay, int keepalive, Plug plug)
{
static struct socket_function_table fn_table = {
ot_tcp_plug,
@ -281,7 +281,7 @@ Socket ot_new(SockAddr addr, int port, int privport, int oobinline,
return (Socket) ret;
}
/* TODO: oobinline, nodelay */
/* TODO: oobinline, nodelay, keepalive */
/*
* Bind to local address.