From 051b7454f80a52d2b0bea2e34562949a3bc70fe4 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Sun, 1 Aug 2004 08:54:01 +0000 Subject: - Added terminal mode handling etc for the client, and window change - Refactored the terminal-mode handling for the server - Improved session closing for the client --HG-- extra : convert_revision : 9d19b4f22c39798af5f3f24c2022f8caec4919e8 --- cli-session.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'cli-session.c') diff --git a/cli-session.c b/cli-session.c index 258d5c4..42770f5 100644 --- a/cli-session.c +++ b/cli-session.c @@ -9,10 +9,13 @@ #include "channel.h" #include "random.h" #include "service.h" +#include "runopts.h" +#include "chansession.h" static void cli_remoteclosed(); static void cli_sessionloop(); static void cli_session_init(); +static void cli_finished(); struct clientsession cli_ses; /* GLOBAL */ @@ -163,6 +166,12 @@ static void cli_sessionloop() { cli_ses.state = SESSION_RUNNING; return; + case SESSION_RUNNING: + if (ses.chancount < 1) { + cli_finished(); + } + return; + /* XXX more here needed */ @@ -174,6 +183,26 @@ static void cli_sessionloop() { } +void cli_session_cleanup() { + + if (!sessinitdone) { + return; + } + cli_tty_cleanup(); + +} + +static void cli_finished() { + + cli_session_cleanup(); + common_session_cleanup(); + fprintf(stderr, "Connection to %s@%s:%s closed.\n", cli_opts.username, + cli_opts.remotehost, cli_opts.remoteport); + exit(EXIT_SUCCESS); +} + + + /* called when the remote side closes the connection */ static void cli_remoteclosed() { -- cgit v1.2.3