|
Lines 162-167
static int connection_out; /* Connection to server (output). */
Link Here
|
| 162 |
static int need_rekeying; /* Set to non-zero if rekeying is requested. */ |
162 |
static int need_rekeying; /* Set to non-zero if rekeying is requested. */ |
| 163 |
static int session_closed; /* In SSH2: login session closed. */ |
163 |
static int session_closed; /* In SSH2: login session closed. */ |
| 164 |
static u_int x11_refuse_time; /* If >0, refuse x11 opens after this time. */ |
164 |
static u_int x11_refuse_time; /* If >0, refuse x11 opens after this time. */ |
|
|
165 |
static time_t server_alive_time; /* Time to do server_alive_check */ |
| 165 |
static void client_init_dispatch(struct ssh *ssh); |
166 |
static void client_init_dispatch(struct ssh *ssh); |
| 166 |
int session_ident = -1; |
167 |
int session_ident = -1; |
|
Lines 495-501
client_wait_until_can_do_something(struct ssh *ssh,
Link Here
|
| 495 |
{ |
496 |
{ |
| 496 |
struct timeval tv, *tvp; |
497 |
struct timeval tv, *tvp; |
| 497 |
int timeout_secs; |
498 |
int timeout_secs; |
| 498 |
time_t minwait_secs = 0, server_alive_time = 0, now = monotime(); |
499 |
time_t minwait_secs = 0, now = monotime(); |
| 499 |
int r, ret; |
500 |
int r, ret; |
| 500 |
/* Add any selections by the channel mechanism. */ |
501 |
/* Add any selections by the channel mechanism. */ |
|
Lines 525-532
client_wait_until_can_do_something(struct ssh *ssh,
Link Here
|
| 525 |
timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */ |
526 |
timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */ |
| 526 |
if (options.server_alive_interval > 0) { |
527 |
if (options.server_alive_interval > 0) { |
| 527 |
timeout_secs = options.server_alive_interval; |
528 |
timeout_secs = server_alive_time - now; |
| 528 |
server_alive_time = now + options.server_alive_interval; |
529 |
if (timeout_secs < 0) |
|
|
530 |
timeout_secs = 0; |
| 529 |
} |
531 |
} |
| 530 |
if (options.rekey_interval > 0 && !rekeying) |
532 |
if (options.rekey_interval > 0 && !rekeying) |
| 531 |
timeout_secs = MINIMUM(timeout_secs, |
533 |
timeout_secs = MINIMUM(timeout_secs, |
|
Lines 565-577
client_wait_until_can_do_something(struct ssh *ssh,
Link Here
|
| 565 |
"select: %s\r\n", strerror(errno))) != 0) |
567 |
"select: %s\r\n", strerror(errno))) != 0) |
| 566 |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
568 |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
| 567 |
quit_pending = 1; |
569 |
quit_pending = 1; |
| 568 |
} else if (ret == 0) { |
570 |
} else { |
| 569 |
/* |
571 |
/* See if keepalive check needs to be done */ |
| 570 |
* Timeout. Could have been either keepalive or rekeying. |
572 |
if (options.server_alive_interval > 0 |
| 571 |
* Keepalive we check here, rekeying is checked in clientloop. |
573 |
&& ! FD_ISSET(connection_in, *readsetp) |
| 572 |
*/ |
574 |
&& (now = monotime()) >= server_alive_time ) { |
| 573 |
if (server_alive_time != 0 && server_alive_time <= monotime()) |
575 |
server_alive_time = now + options.server_alive_interval; |
| 574 |
server_alive_check(ssh); |
576 |
server_alive_check(ssh); |
|
|
577 |
} |
| 575 |
} |
578 |
} |
| 576 |
} |
579 |
} |
|
Lines 613-618
client_process_net_input(struct ssh *ssh, fd_set *readset)
Link Here
|
| 613 |
* the packet subsystem. |
616 |
* the packet subsystem. |
| 614 |
*/ |
617 |
*/ |
| 615 |
if (FD_ISSET(connection_in, readset)) { |
618 |
if (FD_ISSET(connection_in, readset)) { |
|
|
619 |
if (options.server_alive_interval > 0) |
| 620 |
server_alive_time = monotime() + options.server_alive_interval; |
| 616 |
/* Read as much as possible. */ |
621 |
/* Read as much as possible. */ |
| 617 |
len = read(connection_in, buf, sizeof(buf)); |
622 |
len = read(connection_in, buf, sizeof(buf)); |
| 618 |
if (len == 0) { |
623 |
if (len == 0) { |
|
Lines 1314-1319
client_loop(struct ssh *ssh, int have_pty, int escape_char_arg,
Link Here
|
| 1314 |
client_channel_closed, 0); |
1319 |
client_channel_closed, 0); |
| 1315 |
} |
1320 |
} |
|
|
1321 |
if (options.server_alive_interval > 0) |
| 1322 |
server_alive_time = monotime() + options.server_alive_interval; |
| 1323 |
|
| 1316 |
/* Main loop of the client for the interactive session mode. */ |
1324 |
/* Main loop of the client for the interactive session mode. */ |
| 1317 |
while (!quit_pending) { |
1325 |
while (!quit_pending) { |