X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/0c0738d53df1d3f6d1c68e1b01c06c7318b9017a..70bef40ef9163be6649f36762e1b7d0d1f6d715a:/channels.c diff --git a/channels.c b/channels.c index a053b033..473c5efe 100644 --- a/channels.c +++ b/channels.c @@ -39,7 +39,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: channels.c,v 1.157 2002/01/09 17:16:00 markus Exp $"); +RCSID("$OpenBSD: channels.c,v 1.159 2002/01/14 13:55:55 markus Exp $"); #include "ssh.h" #include "ssh1.h" @@ -217,7 +217,6 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, /* Do initial allocation if this is the first call. */ if (channels_alloc == 0) { - chan_init(); channels_alloc = 10; channels = xmalloc(channels_alloc * sizeof(Channel *)); for (i = 0; i < channels_alloc; i++) @@ -246,7 +245,9 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, buffer_init(&c->input); buffer_init(&c->output); buffer_init(&c->extended); - chan_init_iostates(c); + c->ostate = CHAN_OUTPUT_OPEN; + c->istate = CHAN_INPUT_OPEN; + c->flags = 0; channel_register_fds(c, rfd, wfd, efd, extusage, nonblock); c->self = found; c->type = type; @@ -1270,7 +1271,7 @@ channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset) chan_mark_dead(c); return -1; } else if (compat13) { - buffer_consume(&c->output, buffer_len(&c->output)); + buffer_clear(&c->output); c->type = SSH_CHANNEL_INPUT_DRAINING; debug("channel %d: input draining.", c->self); } else { @@ -1312,7 +1313,7 @@ channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) chan_mark_dead(c); return -1; } else if (compat13) { - buffer_consume(&c->output, buffer_len(&c->output)); + buffer_clear(&c->output); debug("channel %d: input draining.", c->self); c->type = SSH_CHANNEL_INPUT_DRAINING; } else { @@ -1425,7 +1426,7 @@ channel_post_output_drain_13(Channel *c, fd_set * readset, fd_set * writeset) len = write(c->sock, buffer_ptr(&c->output), buffer_len(&c->output)); if (len <= 0) - buffer_consume(&c->output, buffer_len(&c->output)); + buffer_clear(&c->output); else buffer_consume(&c->output, len); } @@ -1828,7 +1829,7 @@ channel_input_close(int type, u_int32_t seq, void *ctxt) * Not a closed channel - mark it as draining, which will * cause it to be freed later. */ - buffer_consume(&c->input, buffer_len(&c->input)); + buffer_clear(&c->input); c->type = SSH_CHANNEL_OUTPUT_DRAINING; } }