summaryrefslogtreecommitdiffhomepage
path: root/cli-session.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2004-08-01 08:54:01 +0000
committerMatt Johnston <matt@ucc.asn.au>2004-08-01 08:54:01 +0000
commit051b7454f80a52d2b0bea2e34562949a3bc70fe4 (patch)
tree4414c89d8e9ffc08d15721d3d02756b6f0dcdd83 /cli-session.c
parentcb071834dab43b2edf6112a9918714691f27f3de (diff)
- 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
Diffstat (limited to 'cli-session.c')
-rw-r--r--cli-session.c29
1 files changed, 29 insertions, 0 deletions
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() {