View | Details | Raw Unified | Return to bug 179 | Differences between
and this patch

Collapse All | Expand All

(-)channels.c (-1 / +11 lines)
Lines 1562-1567 Link Here
1562
	channel_handler(channel_post, readset, writeset);
1562
	channel_handler(channel_post, readset, writeset);
1563
}
1563
}
1564
1564
1565
#define CHANNEL_EFD_ALIVE(c) \
1566
	(compat20 && c->extended_usage == CHAN_EXTENDED_READ && \
1567
	(c->efd != -1 || buffer_len(&c->extended) > 0))
1568
1565
1569
1566
/* If there is data to send to the connection, enqueue some of it now. */
1570
/* If there is data to send to the connection, enqueue some of it now. */
1567
1571
Lines 1634-1640 Link Here
1634
			 * input-buffer is empty and read-socket shutdown:
1638
			 * input-buffer is empty and read-socket shutdown:
1635
			 * tell peer, that we will not send more data: send IEOF
1639
			 * tell peer, that we will not send more data: send IEOF
1636
			 */
1640
			 */
1637
			chan_ibuf_empty(c);
1641
			if (CHANNEL_EFD_ALIVE(c))
1642
                               debug2("channel %d: ibuf_empty delayed efd %d/(%d)",
1643
                                   c->self, c->efd, buffer_len(&c->extended));
1644
			else
1645
				chan_ibuf_empty(c);
1638
		}
1646
		}
1639
		/* Send extended data, i.e. stderr */
1647
		/* Send extended data, i.e. stderr */
1640
		if (compat20 &&
1648
		if (compat20 &&
Lines 1726-1731 Link Here
1726
		log("channel %d: ext data for non open", id);
1734
		log("channel %d: ext data for non open", id);
1727
		return;
1735
		return;
1728
	}
1736
	}
1737
	if (c->ostate == CHAN_OUTPUT_CLOSED)
1738
		debug2("channel %d: ext data for OUTPUT_CLOSED [error]", id);
1729
	tcode = packet_get_int();
1739
	tcode = packet_get_int();
1730
	if (c->efd == -1 ||
1740
	if (c->efd == -1 ||
1731
	    c->extended_usage != CHAN_EXTENDED_WRITE ||
1741
	    c->extended_usage != CHAN_EXTENDED_WRITE ||
(-)nchan.c (-31 / +14 lines)
Lines 404-442 Link Here
404
		debug("channel %d: is dead", c->self);
404
		debug("channel %d: is dead", c->self);
405
		return 1;
405
		return 1;
406
	}
406
	}
407
	/*
407
	if (!(c->flags & CHAN_CLOSE_SENT)) {
408
	 * we have to delay the close message if the efd (for stderr) is
408
		if (send) {
409
	 * still active
409
			chan_send_close2(c);
410
	 */
410
		} else {
411
	if (((c->extended_usage != CHAN_EXTENDED_IGNORE) &&
411
			/* channel would be dead if we sent a close */
412
	    buffer_len(&c->extended) > 0)
412
			if (c->flags & CHAN_CLOSE_RCVD) {
413
#if 0
413
				debug("channel %d: almost dead",
414
	    || ((c->extended_usage == CHAN_EXTENDED_READ) &&
414
				    c->self);
415
	    c->efd != -1)
415
				return 1;
416
#endif
417
	    ) {
418
		debug2("channel %d: active efd: %d len %d type %s",
419
		    c->self, c->efd, buffer_len(&c->extended),
420
		    c->extended_usage==CHAN_EXTENDED_READ ?
421
		    "read": "write");
422
	} else {
423
		if (!(c->flags & CHAN_CLOSE_SENT)) {
424
			if (send) {
425
				chan_send_close2(c);
426
			} else {
427
				/* channel would be dead if we sent a close */
428
				if (c->flags & CHAN_CLOSE_RCVD) {
429
					debug("channel %d: almost dead",
430
					    c->self);
431
					return 1;
432
				}
433
			}
416
			}
434
		}
417
		}
435
		if ((c->flags & CHAN_CLOSE_SENT) &&
418
	}
436
		    (c->flags & CHAN_CLOSE_RCVD)) {
419
	if ((c->flags & CHAN_CLOSE_SENT) &&
437
			debug("channel %d: is dead", c->self);
420
	    (c->flags & CHAN_CLOSE_RCVD)) {
438
			return 1;
421
		debug("channel %d: is dead", c->self);
439
		}
422
		return 1;
440
	}
423
	}
441
	return 0;
424
	return 0;
442
}
425
}

Return to bug 179