summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/channels.c b/channels.c
index af858b4a5..b0bc77901 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.224 2005/09/07 08:53:53 markus Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.225 2005/10/10 10:23:08 djm Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -269,6 +269,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
269 c->force_drain = 0; 269 c->force_drain = 0;
270 c->single_connection = 0; 270 c->single_connection = 0;
271 c->detach_user = NULL; 271 c->detach_user = NULL;
272 c->detach_close = 0;
272 c->confirm = NULL; 273 c->confirm = NULL;
273 c->confirm_ctx = NULL; 274 c->confirm_ctx = NULL;
274 c->input_filter = NULL; 275 c->input_filter = NULL;
@@ -628,7 +629,7 @@ channel_register_confirm(int id, channel_callback_fn *fn, void *ctx)
628 c->confirm_ctx = ctx; 629 c->confirm_ctx = ctx;
629} 630}
630void 631void
631channel_register_cleanup(int id, channel_callback_fn *fn) 632channel_register_cleanup(int id, channel_callback_fn *fn, int do_close)
632{ 633{
633 Channel *c = channel_lookup(id); 634 Channel *c = channel_lookup(id);
634 635
@@ -637,6 +638,7 @@ channel_register_cleanup(int id, channel_callback_fn *fn)
637 return; 638 return;
638 } 639 }
639 c->detach_user = fn; 640 c->detach_user = fn;
641 c->detach_close = do_close;
640} 642}
641void 643void
642channel_cancel_cleanup(int id) 644channel_cancel_cleanup(int id)
@@ -648,6 +650,7 @@ channel_cancel_cleanup(int id)
648 return; 650 return;
649 } 651 }
650 c->detach_user = NULL; 652 c->detach_user = NULL;
653 c->detach_close = 0;
651} 654}
652void 655void
653channel_register_filter(int id, channel_filter_fn *fn) 656channel_register_filter(int id, channel_filter_fn *fn)
@@ -1666,7 +1669,7 @@ channel_garbage_collect(Channel *c)
1666 if (c == NULL) 1669 if (c == NULL)
1667 return; 1670 return;
1668 if (c->detach_user != NULL) { 1671 if (c->detach_user != NULL) {
1669 if (!chan_is_dead(c, 0)) 1672 if (!chan_is_dead(c, c->detach_close))
1670 return; 1673 return;
1671 debug2("channel %d: gc: notify user", c->self); 1674 debug2("channel %d: gc: notify user", c->self);
1672 c->detach_user(c->self, NULL); 1675 c->detach_user(c->self, NULL);