aboutsummaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2008-07-23 09:23:42 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2008-07-23 09:23:42 +0000
commit490bfaade9fd39fe364761a9abb9e53381c5571c (patch)
tree043f54862360ff8a1158c881c9634f7ee0cd52b9 /channels.c
parent8211d6b01828096abeefb4a88cd06030d0097c10 (diff)
downloadsrc-490bfaade9fd39fe364761a9abb9e53381c5571c.tar.gz
src-490bfaade9fd39fe364761a9abb9e53381c5571c.zip
Notes
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/channels.c b/channels.c
index c68ad6419f85..2006353d40e7 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.268 2007/01/03 03:01:40 stevesk Exp $ */
+/* $OpenBSD: channels.c,v 1.270 2007/06/25 08:20:03 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1446,14 +1446,13 @@ static int
channel_handle_rfd(Channel *c, fd_set *readset, fd_set *writeset)
{
char buf[CHAN_RBUF];
- int len;
+ int len, force;
- if (c->rfd != -1 &&
- (c->detach_close || FD_ISSET(c->rfd, readset))) {
+ force = c->isatty && c->detach_close && c->istate != CHAN_INPUT_CLOSED;
+ if (c->rfd != -1 && (force || FD_ISSET(c->rfd, readset))) {
errno = 0;
len = read(c->rfd, buf, sizeof(buf));
- if (len < 0 && (errno == EINTR ||
- (errno == EAGAIN && !(c->isatty && c->detach_close))))
+ if (len < 0 && (errno == EINTR || (errno == EAGAIN && !force)))
return 1;
#ifndef PTY_ZEROREAD
if (len <= 0) {
@@ -1658,7 +1657,9 @@ channel_check_window(Channel *c)
{
if (c->type == SSH_CHANNEL_OPEN &&
!(c->flags & (CHAN_CLOSE_SENT|CHAN_CLOSE_RCVD)) &&
- c->local_window < c->local_window_max/2 &&
+ ((c->local_window_max - c->local_window >
+ c->local_maxpacket*3) ||
+ c->local_window < c->local_window_max/2) &&
c->local_consumed > 0) {
packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
packet_put_int(c->remote_id);