mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-03 04:22:47 -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:
9
ssh.c
9
ssh.c
@ -2128,7 +2128,7 @@ static void ssh_sent(Plug plug, int bufsize)
|
||||
* freed by the caller.
|
||||
*/
|
||||
static const char *connect_to_host(Ssh ssh, char *host, int port,
|
||||
char **realhost, int nodelay)
|
||||
char **realhost, int nodelay, int keepalive)
|
||||
{
|
||||
static const struct plug_function_table fn_table = {
|
||||
ssh_closing,
|
||||
@ -2169,7 +2169,7 @@ static const char *connect_to_host(Ssh ssh, char *host, int port,
|
||||
}
|
||||
ssh->fn = &fn_table;
|
||||
ssh->s = new_connection(addr, *realhost, port,
|
||||
0, 1, nodelay, (Plug) ssh, &ssh->cfg);
|
||||
0, 1, nodelay, keepalive, (Plug) ssh, &ssh->cfg);
|
||||
if ((err = sk_socket_error(ssh->s)) != NULL) {
|
||||
ssh->s = NULL;
|
||||
return err;
|
||||
@ -6183,7 +6183,8 @@ static void ssh2_protocol(Ssh ssh, unsigned char *in, int inlen, int ispkt)
|
||||
*/
|
||||
static const char *ssh_init(void *frontend_handle, void **backend_handle,
|
||||
Config *cfg,
|
||||
char *host, int port, char **realhost, int nodelay)
|
||||
char *host, int port, char **realhost, int nodelay,
|
||||
int keepalive)
|
||||
{
|
||||
const char *p;
|
||||
Ssh ssh;
|
||||
@ -6267,7 +6268,7 @@ static const char *ssh_init(void *frontend_handle, void **backend_handle,
|
||||
|
||||
ssh->protocol = NULL;
|
||||
|
||||
p = connect_to_host(ssh, host, port, realhost, nodelay);
|
||||
p = connect_to_host(ssh, host, port, realhost, nodelay, keepalive);
|
||||
if (p != NULL)
|
||||
return p;
|
||||
|
||||
|
Reference in New Issue
Block a user