- debug3("channel %d: chan_delete_if_full_closed2: istate %d ostate %d",
- c->self, c->istate, c->ostate);
- if (c->istate == CHAN_INPUT_CLOSED && c->ostate == CHAN_OUTPUT_CLOSED) {
+ if (c->type == SSH_CHANNEL_ZOMBIE) {
+ debug("channel %d: zombie", c->self);
+ return 1;
+ }
+ if (c->istate != CHAN_INPUT_CLOSED || c->ostate != CHAN_OUTPUT_CLOSED)
+ return 0;
+ if (!compat20) {
+ debug("channel %d: is dead", c->self);
+ return 1;
+ }
+ /*
+ * we have to delay the close message if the efd (for stderr) is
+ * still active
+ */
+ if (((c->extended_usage != CHAN_EXTENDED_IGNORE) &&
+ buffer_len(&c->extended) > 0)
+#if 0
+ || ((c->extended_usage == CHAN_EXTENDED_READ) &&
+ c->efd != -1)
+#endif
+ ) {
+ debug2("channel %d: active efd: %d len %d type %s",
+ c->self, c->efd, buffer_len(&c->extended),
+ c->extended_usage==CHAN_EXTENDED_READ ?
+ "read": "write");
+ } else {