[nchan.c]
     merge chan_[io]buf_empty[12]; ok provos@
This commit is contained in:
Damien Miller 2002-01-22 23:27:45 +11:00
parent 89a9232e41
commit fcfc43b617
2 changed files with 20 additions and 38 deletions

View File

@ -163,6 +163,12 @@
[channels.h nchan.c] [channels.h nchan.c]
add chan_set_[io]state(), order states, state is now an u_int, add chan_set_[io]state(), order states, state is now an u_int,
simplifies debugging messages; ok provos@ simplifies debugging messages; ok provos@
- markus@cvs.openbsd.org 2002/01/14 13:22:35
[nchan.c]
chan_send_oclose1() no longer calls chan_shutdown_write(); ok provos@
- markus@cvs.openbsd.org 2002/01/14 13:34:07
[nchan.c]
merge chan_[io]buf_empty[12]; ok provos@
20020121 20020121
@ -7311,4 +7317,4 @@
- Wrote replacements for strlcpy and mkdtemp - Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1 - Released 1.0pre1
$Id: ChangeLog,v 1.1769 2002/01/22 12:27:11 djm Exp $ $Id: ChangeLog,v 1.1770 2002/01/22 12:27:45 djm Exp $

50
nchan.c
View File

@ -23,7 +23,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: nchan.c,v 1.38 2002/01/14 13:22:35 markus Exp $"); RCSID("$OpenBSD: nchan.c,v 1.39 2002/01/14 13:34:07 markus Exp $");
#include "ssh1.h" #include "ssh1.h"
#include "ssh2.h" #include "ssh2.h"
@ -159,8 +159,14 @@ chan_ibuf_empty1(Channel *c)
} }
switch (c->istate) { switch (c->istate) {
case CHAN_INPUT_WAIT_DRAIN: case CHAN_INPUT_WAIT_DRAIN:
chan_send_ieof1(c); if (compat20) {
chan_set_istate(c, CHAN_INPUT_WAIT_OCLOSE); if (!(c->flags & CHAN_CLOSE_SENT))
chan_send_eof2(c);
chan_set_istate(c, CHAN_INPUT_CLOSED);
} else {
chan_send_ieof1(c);
chan_set_istate(c, CHAN_INPUT_WAIT_OCLOSE);
}
break; break;
default: default:
error("channel %d: chan_ibuf_empty for istate %d", error("channel %d: chan_ibuf_empty for istate %d",
@ -218,7 +224,8 @@ chan_obuf_empty1(Channel *c)
switch (c->ostate) { switch (c->ostate) {
case CHAN_OUTPUT_WAIT_DRAIN: case CHAN_OUTPUT_WAIT_DRAIN:
chan_shutdown_write(c); chan_shutdown_write(c);
chan_send_oclose1(c); if (!compat20)
chan_send_oclose1(c);
chan_set_ostate(c, CHAN_OUTPUT_CLOSED); chan_set_ostate(c, CHAN_OUTPUT_CLOSED);
break; break;
default: default:
@ -301,23 +308,7 @@ chan_rcvd_oclose2(Channel *c)
static void static void
chan_ibuf_empty2(Channel *c) chan_ibuf_empty2(Channel *c)
{ {
debug("channel %d: ibuf empty", c->self); chan_ibuf_empty1(c);
if (buffer_len(&c->input)) {
error("channel %d: chan_ibuf_empty for non empty buffer",
c->self);
return;
}
switch (c->istate) {
case CHAN_INPUT_WAIT_DRAIN:
if (!(c->flags & CHAN_CLOSE_SENT))
chan_send_eof2(c);
chan_set_istate(c, CHAN_INPUT_CLOSED);
break;
default:
error("channel %d: chan_ibuf_empty for istate %d",
c->self, c->istate);
break;
}
} }
static void static void
chan_rcvd_ieof2(Channel *c) chan_rcvd_ieof2(Channel *c)
@ -348,22 +339,7 @@ chan_write_failed2(Channel *c)
static void static void
chan_obuf_empty2(Channel *c) chan_obuf_empty2(Channel *c)
{ {
debug("channel %d: obuf empty", c->self); chan_obuf_empty1(c);
if (buffer_len(&c->output)) {
error("channel %d: chan_obuf_empty for non empty buffer",
c->self);
return;
}
switch (c->ostate) {
case CHAN_OUTPUT_WAIT_DRAIN:
chan_shutdown_write(c);
chan_set_ostate(c, CHAN_OUTPUT_CLOSED);
break;
default:
error("channel %d: chan_obuf_empty for ostate %d",
c->self, c->ostate);
break;
}
} }
static void static void
chan_send_eof2(Channel *c) chan_send_eof2(Channel *c)