summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/clientloop.c b/clientloop.c
index a2d2d1d07..9a7dc0ab0 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.209 2009/02/12 03:00:56 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.213 2009/07/05 19:28:33 stevesk Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -109,6 +109,7 @@
109#include "misc.h" 109#include "misc.h"
110#include "match.h" 110#include "match.h"
111#include "msg.h" 111#include "msg.h"
112#include "roaming.h"
112 113
113/* import options */ 114/* import options */
114extern Options options; 115extern Options options;
@@ -491,13 +492,13 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt)
491 xfree(gc); 492 xfree(gc);
492 } 493 }
493 494
494 keep_alive_timeouts = 0; 495 packet_set_alive_timeouts(0);
495} 496}
496 497
497static void 498static void
498server_alive_check(void) 499server_alive_check(void)
499{ 500{
500 if (++keep_alive_timeouts > options.server_alive_count_max) { 501 if (packet_inc_alive_timeouts() > options.server_alive_count_max) {
501 logit("Timeout, server not responding."); 502 logit("Timeout, server not responding.");
502 cleanup_exit(255); 503 cleanup_exit(255);
503 } 504 }
@@ -634,8 +635,8 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr)
634static void 635static void
635client_process_net_input(fd_set *readset) 636client_process_net_input(fd_set *readset)
636{ 637{
637 int len; 638 int len, cont = 0;
638 char buf[8192]; 639 char buf[SSH_IOBUFSZ];
639 640
640 /* 641 /*
641 * Read input from the server, and add any such data to the buffer of 642 * Read input from the server, and add any such data to the buffer of
@@ -643,8 +644,8 @@ client_process_net_input(fd_set *readset)
643 */ 644 */
644 if (FD_ISSET(connection_in, readset)) { 645 if (FD_ISSET(connection_in, readset)) {
645 /* Read as much as possible. */ 646 /* Read as much as possible. */
646 len = read(connection_in, buf, sizeof(buf)); 647 len = roaming_read(connection_in, buf, sizeof(buf), &cont);
647 if (len == 0) { 648 if (len == 0 && cont == 0) {
648 /* 649 /*
649 * Received EOF. The remote host has closed the 650 * Received EOF. The remote host has closed the
650 * connection. 651 * connection.
@@ -1128,7 +1129,7 @@ static void
1128client_process_input(fd_set *readset) 1129client_process_input(fd_set *readset)
1129{ 1130{
1130 int len; 1131 int len;
1131 char buf[8192]; 1132 char buf[SSH_IOBUFSZ];
1132 1133
1133 /* Read input from stdin. */ 1134 /* Read input from stdin. */
1134 if (FD_ISSET(fileno(stdin), readset)) { 1135 if (FD_ISSET(fileno(stdin), readset)) {
@@ -1476,6 +1477,14 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1476 /* Stop watching for window change. */ 1477 /* Stop watching for window change. */
1477 signal(SIGWINCH, SIG_DFL); 1478 signal(SIGWINCH, SIG_DFL);
1478 1479
1480 if (compat20) {
1481 packet_start(SSH2_MSG_DISCONNECT);
1482 packet_put_int(SSH2_DISCONNECT_BY_APPLICATION);
1483 packet_put_cstring("disconnected by user");
1484 packet_send();
1485 packet_write_wait();
1486 }
1487
1479 channel_free_all(); 1488 channel_free_all();
1480 1489
1481 if (have_pty) 1490 if (have_pty)