summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2011-05-05 14:16:22 +1000
committerDamien Miller <djm@mindrot.org>2011-05-05 14:16:22 +1000
commit6c3eec7ab23d58157ded8a0e6283f93e45390d07 (patch)
tree3beb55b3ca050613a158865ec350008dcdd0ab72 /clientloop.c
parentad21032e656aefcddb2cc52f014885026ba82d56 (diff)
- djm@cvs.openbsd.org 2011/04/17 22:42:42
[PROTOCOL.mux clientloop.c clientloop.h mux.c ssh.1 ssh.c] allow graceful shutdown of multiplexing: request that a mux server removes its listener socket and refuse future multiplexing requests; ok markus@
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/clientloop.c b/clientloop.c
index f6c1444a3..502dd982c 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.231 2011/01/16 12:05:59 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.232 2011/04/17 22:42:41 djm 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
@@ -265,10 +265,10 @@ static void
265set_control_persist_exit_time(void) 265set_control_persist_exit_time(void)
266{ 266{
267 if (muxserver_sock == -1 || !options.control_persist 267 if (muxserver_sock == -1 || !options.control_persist
268 || options.control_persist_timeout == 0) 268 || options.control_persist_timeout == 0) {
269 /* not using a ControlPersist timeout */ 269 /* not using a ControlPersist timeout */
270 control_persist_exit_time = 0; 270 control_persist_exit_time = 0;
271 else if (channel_still_open()) { 271 } else if (channel_still_open()) {
272 /* some client connections are still open */ 272 /* some client connections are still open */
273 if (control_persist_exit_time > 0) 273 if (control_persist_exit_time > 0)
274 debug2("%s: cancel scheduled exit", __func__); 274 debug2("%s: cancel scheduled exit", __func__);
@@ -1419,14 +1419,17 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1419 1419
1420 if (compat20) { 1420 if (compat20) {
1421 session_ident = ssh2_chan_id; 1421 session_ident = ssh2_chan_id;
1422 if (escape_char_arg != SSH_ESCAPECHAR_NONE) 1422 if (session_ident != -1) {
1423 channel_register_filter(session_ident, 1423 if (escape_char_arg != SSH_ESCAPECHAR_NONE) {
1424 client_simple_escape_filter, NULL, 1424 channel_register_filter(session_ident,
1425 client_filter_cleanup, 1425 client_simple_escape_filter, NULL,
1426 client_new_escape_filter_ctx(escape_char_arg)); 1426 client_filter_cleanup,
1427 if (session_ident != -1) 1427 client_new_escape_filter_ctx(
1428 escape_char_arg));
1429 }
1428 channel_register_cleanup(session_ident, 1430 channel_register_cleanup(session_ident,
1429 client_channel_closed, 0); 1431 client_channel_closed, 0);
1432 }
1430 } else { 1433 } else {
1431 /* Check if we should immediately send eof on stdin. */ 1434 /* Check if we should immediately send eof on stdin. */
1432 client_check_initial_eof_on_stdin(); 1435 client_check_initial_eof_on_stdin();
@@ -2122,6 +2125,19 @@ client_init_dispatch(void)
2122 client_init_dispatch_15(); 2125 client_init_dispatch_15();
2123} 2126}
2124 2127
2128void
2129client_stop_mux(void)
2130{
2131 if (options.control_path != NULL && muxserver_sock != -1)
2132 unlink(options.control_path);
2133 /*
2134 * If we are in persist mode, signal that we should close when all
2135 * active channels are closed.
2136 */
2137 if (options.control_persist)
2138 session_closed = 1;
2139}
2140
2125/* client specific fatal cleanup */ 2141/* client specific fatal cleanup */
2126void 2142void
2127cleanup_exit(int i) 2143cleanup_exit(int i)