summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--nchan.c50
2 files changed, 20 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index c9bc5f1ff..6211b4340 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -163,6 +163,12 @@
163 [channels.h nchan.c] 163 [channels.h nchan.c]
164 add chan_set_[io]state(), order states, state is now an u_int, 164 add chan_set_[io]state(), order states, state is now an u_int,
165 simplifies debugging messages; ok provos@ 165 simplifies debugging messages; ok provos@
166 - markus@cvs.openbsd.org 2002/01/14 13:22:35
167 [nchan.c]
168 chan_send_oclose1() no longer calls chan_shutdown_write(); ok provos@
169 - markus@cvs.openbsd.org 2002/01/14 13:34:07
170 [nchan.c]
171 merge chan_[io]buf_empty[12]; ok provos@
166 172
167 173
16820020121 17420020121
@@ -7311,4 +7317,4 @@
7311 - Wrote replacements for strlcpy and mkdtemp 7317 - Wrote replacements for strlcpy and mkdtemp
7312 - Released 1.0pre1 7318 - Released 1.0pre1
7313 7319
7314$Id: ChangeLog,v 1.1769 2002/01/22 12:27:11 djm Exp $ 7320$Id: ChangeLog,v 1.1770 2002/01/22 12:27:45 djm Exp $
diff --git a/nchan.c b/nchan.c
index ff7607b9c..76674a76d 100644
--- a/nchan.c
+++ b/nchan.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: nchan.c,v 1.38 2002/01/14 13:22:35 markus Exp $"); 26RCSID("$OpenBSD: nchan.c,v 1.39 2002/01/14 13:34:07 markus Exp $");
27 27
28#include "ssh1.h" 28#include "ssh1.h"
29#include "ssh2.h" 29#include "ssh2.h"
@@ -159,8 +159,14 @@ chan_ibuf_empty1(Channel *c)
159 } 159 }
160 switch (c->istate) { 160 switch (c->istate) {
161 case CHAN_INPUT_WAIT_DRAIN: 161 case CHAN_INPUT_WAIT_DRAIN:
162 chan_send_ieof1(c); 162 if (compat20) {
163 chan_set_istate(c, CHAN_INPUT_WAIT_OCLOSE); 163 if (!(c->flags & CHAN_CLOSE_SENT))
164 chan_send_eof2(c);
165 chan_set_istate(c, CHAN_INPUT_CLOSED);
166 } else {
167 chan_send_ieof1(c);
168 chan_set_istate(c, CHAN_INPUT_WAIT_OCLOSE);
169 }
164 break; 170 break;
165 default: 171 default:
166 error("channel %d: chan_ibuf_empty for istate %d", 172 error("channel %d: chan_ibuf_empty for istate %d",
@@ -218,7 +224,8 @@ chan_obuf_empty1(Channel *c)
218 switch (c->ostate) { 224 switch (c->ostate) {
219 case CHAN_OUTPUT_WAIT_DRAIN: 225 case CHAN_OUTPUT_WAIT_DRAIN:
220 chan_shutdown_write(c); 226 chan_shutdown_write(c);
221 chan_send_oclose1(c); 227 if (!compat20)
228 chan_send_oclose1(c);
222 chan_set_ostate(c, CHAN_OUTPUT_CLOSED); 229 chan_set_ostate(c, CHAN_OUTPUT_CLOSED);
223 break; 230 break;
224 default: 231 default:
@@ -301,23 +308,7 @@ chan_rcvd_oclose2(Channel *c)
301static void 308static void
302chan_ibuf_empty2(Channel *c) 309chan_ibuf_empty2(Channel *c)
303{ 310{
304 debug("channel %d: ibuf empty", c->self); 311 chan_ibuf_empty1(c);
305 if (buffer_len(&c->input)) {
306 error("channel %d: chan_ibuf_empty for non empty buffer",
307 c->self);
308 return;
309 }
310 switch (c->istate) {
311 case CHAN_INPUT_WAIT_DRAIN:
312 if (!(c->flags & CHAN_CLOSE_SENT))
313 chan_send_eof2(c);
314 chan_set_istate(c, CHAN_INPUT_CLOSED);
315 break;
316 default:
317 error("channel %d: chan_ibuf_empty for istate %d",
318 c->self, c->istate);
319 break;
320 }
321} 312}
322static void 313static void
323chan_rcvd_ieof2(Channel *c) 314chan_rcvd_ieof2(Channel *c)
@@ -348,22 +339,7 @@ chan_write_failed2(Channel *c)
348static void 339static void
349chan_obuf_empty2(Channel *c) 340chan_obuf_empty2(Channel *c)
350{ 341{
351 debug("channel %d: obuf empty", c->self); 342 chan_obuf_empty1(c);
352 if (buffer_len(&c->output)) {
353 error("channel %d: chan_obuf_empty for non empty buffer",
354 c->self);
355 return;
356 }
357 switch (c->ostate) {
358 case CHAN_OUTPUT_WAIT_DRAIN:
359 chan_shutdown_write(c);
360 chan_set_ostate(c, CHAN_OUTPUT_CLOSED);
361 break;
362 default:
363 error("channel %d: chan_obuf_empty for ostate %d",
364 c->self, c->ostate);
365 break;
366 }
367} 343}
368static void 344static void
369chan_send_eof2(Channel *c) 345chan_send_eof2(Channel *c)