version 1.23.2.3, 2002/03/09 00:20:44 |
version 1.23.2.4, 2002/06/02 22:56:10 |
|
|
chan_rcvd_eof2(Channel *c) |
chan_rcvd_eof2(Channel *c) |
{ |
{ |
debug("channel %d: rcvd eof", c->self); |
debug("channel %d: rcvd eof", c->self); |
|
c->flags |= CHAN_EOF_RCVD; |
if (c->ostate == CHAN_OUTPUT_OPEN) |
if (c->ostate == CHAN_OUTPUT_OPEN) |
chan_set_ostate(c, CHAN_OUTPUT_WAIT_DRAIN); |
chan_set_ostate(c, CHAN_OUTPUT_WAIT_DRAIN); |
} |
} |
|
|
packet_start(SSH2_MSG_CHANNEL_EOF); |
packet_start(SSH2_MSG_CHANNEL_EOF); |
packet_put_int(c->remote_id); |
packet_put_int(c->remote_id); |
packet_send(); |
packet_send(); |
|
c->flags |= CHAN_EOF_SENT; |
break; |
break; |
default: |
default: |
error("channel %d: cannot send eof for istate %d", |
error("channel %d: cannot send eof for istate %d", |
|
|
else |
else |
chan_rcvd_ieof1(c); |
chan_rcvd_ieof1(c); |
if (c->ostate == CHAN_OUTPUT_WAIT_DRAIN && |
if (c->ostate == CHAN_OUTPUT_WAIT_DRAIN && |
buffer_len(&c->output) == 0) |
buffer_len(&c->output) == 0 && |
|
!CHANNEL_EFD_OUTPUT_ACTIVE(c)) |
chan_obuf_empty(c); |
chan_obuf_empty(c); |
} |
} |
void |
void |
|
|
debug("channel %d: is dead", c->self); |
debug("channel %d: is dead", c->self); |
return 1; |
return 1; |
} |
} |
/* |
if ((datafellows & SSH_BUG_EXTEOF) && |
* we have to delay the close message if the efd (for stderr) is |
c->extended_usage == CHAN_EXTENDED_WRITE && |
* still active |
c->efd != -1 && |
*/ |
buffer_len(&c->extended) > 0) { |
if (((c->extended_usage != CHAN_EXTENDED_IGNORE) && |
debug2("channel %d: active efd: %d len %d", |
buffer_len(&c->extended) > 0) |
c->self, c->efd, buffer_len(&c->extended)); |
#if 0 |
return 0; |
|| ((c->extended_usage == CHAN_EXTENDED_READ) && |
} |
c->efd != -1) |
if (!(c->flags & CHAN_CLOSE_SENT)) { |
#endif |
if (send) { |
) { |
chan_send_close2(c); |
debug2("channel %d: active efd: %d len %d type %s", |
} else { |
c->self, c->efd, buffer_len(&c->extended), |
/* channel would be dead if we sent a close */ |
c->extended_usage==CHAN_EXTENDED_READ ? |
if (c->flags & CHAN_CLOSE_RCVD) { |
"read": "write"); |
debug("channel %d: almost dead", |
} else { |
c->self); |
if (!(c->flags & CHAN_CLOSE_SENT)) { |
return 1; |
if (send) { |
|
chan_send_close2(c); |
|
} else { |
|
/* channel would be dead if we sent a close */ |
|
if (c->flags & CHAN_CLOSE_RCVD) { |
|
debug("channel %d: almost dead", |
|
c->self); |
|
return 1; |
|
} |
|
} |
} |
} |
} |
if ((c->flags & CHAN_CLOSE_SENT) && |
} |
(c->flags & CHAN_CLOSE_RCVD)) { |
if ((c->flags & CHAN_CLOSE_SENT) && |
debug("channel %d: is dead", c->self); |
(c->flags & CHAN_CLOSE_RCVD)) { |
return 1; |
debug("channel %d: is dead", c->self); |
} |
return 1; |
} |
} |
return 0; |
return 0; |
} |
} |