summaryrefslogtreecommitdiffhomepage
path: root/cli-session.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2013-04-01 22:26:55 +0800
committerMatt Johnston <matt@ucc.asn.au>2013-04-01 22:26:55 +0800
commit90b5691183f12d348d2651e026e8438ad278c2be (patch)
tree666eaed108e24b447ce27b42b9cbd5d574427972 /cli-session.c
parent5af0d33164261fb9603d1b44f715d63659799373 (diff)
Run the cleanup handler also when we close due to TCP connection being closed
Diffstat (limited to 'cli-session.c')
-rw-r--r--cli-session.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cli-session.c b/cli-session.c
index 3adec73..0c6635a 100644
--- a/cli-session.c
+++ b/cli-session.c
@@ -42,6 +42,7 @@ static void cli_sessionloop();
static void cli_session_init();
static void cli_finished();
static void recv_msg_service_accept(void);
+static void cli_session_cleanup(void);
struct clientsession cli_ses; /* GLOBAL */
@@ -143,6 +144,7 @@ static void cli_session_init() {
/* For printing "remote host closed" for the user */
ses.remoteclosed = cli_remoteclosed;
+ ses.extra_session_cleanup = cli_session_cleanup;
ses.buf_match_algo = cli_buf_match_algo;
/* packet handlers */
@@ -290,7 +292,7 @@ static void cli_sessionloop() {
}
-void cli_session_cleanup() {
+static void cli_session_cleanup(void) {
if (!sessinitdone) {
return;
@@ -308,8 +310,7 @@ void cli_session_cleanup() {
static void cli_finished() {
- cli_session_cleanup();
- common_session_cleanup();
+ session_cleanup();
fprintf(stderr, "Connection to %s@%s:%s closed.\n", cli_opts.username,
cli_opts.remotehost, cli_opts.remoteport);
exit(cli_ses.retval);