1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

The structural reorganisation of ssh.c (r4909) caused

ssh2_try_send() to no longer be run after receiving WINDOW_ADJUSTs.
I believe this is likely to have been the cause of recent PSCP
hanging issues.

[originally from svn r5517]
[r4909 == 02b0474f57]
This commit is contained in:
Simon Tatham 2005-03-17 19:49:51 +00:00
parent 69209db8ea
commit 7e41c571db

56
ssh.c
View File

@ -5677,6 +5677,32 @@ static int ssh2_try_send(struct ssh_channel *c)
return bufchain_size(&c->v.v2.outbuffer); return bufchain_size(&c->v.v2.outbuffer);
} }
static void ssh2_try_send_and_unthrottle(struct ssh_channel *c)
{
int bufsize;
if (c->closes)
return; /* don't send on closing channels */
bufsize = ssh2_try_send(c);
if (bufsize == 0) {
switch (c->type) {
case CHAN_MAINSESSION:
/* stdin need not receive an unthrottle
* notification since it will be polled */
break;
case CHAN_X11:
x11_unthrottle(c->u.x11.s);
break;
case CHAN_AGENT:
/* agent sockets are request/response and need no
* buffer management */
break;
case CHAN_SOCKDATA:
pfd_unthrottle(c->u.pfd.s);
break;
}
}
}
/* /*
* Potentially enlarge the window on an SSH-2 channel. * Potentially enlarge the window on an SSH-2 channel.
*/ */
@ -5715,8 +5741,10 @@ static void ssh2_msg_channel_window_adjust(Ssh ssh, struct Packet *pktin)
unsigned i = ssh_pkt_getuint32(pktin); unsigned i = ssh_pkt_getuint32(pktin);
struct ssh_channel *c; struct ssh_channel *c;
c = find234(ssh->channels, &i, ssh_channelfind); c = find234(ssh->channels, &i, ssh_channelfind);
if (c && !c->closes) if (c && !c->closes) {
c->v.v2.remwindow += ssh_pkt_getuint32(pktin); c->v.v2.remwindow += ssh_pkt_getuint32(pktin);
ssh2_try_send_and_unthrottle(c);
}
} }
static void ssh2_msg_channel_data(Ssh ssh, struct Packet *pktin) static void ssh2_msg_channel_data(Ssh ssh, struct Packet *pktin)
@ -7414,30 +7442,8 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
/* /*
* Try to send data on all channels if we can. * Try to send data on all channels if we can.
*/ */
for (i = 0; NULL != (c = index234(ssh->channels, i)); i++) { for (i = 0; NULL != (c = index234(ssh->channels, i)); i++)
int bufsize; ssh2_try_send_and_unthrottle(c);
if (c->closes)
continue; /* don't send on closing channels */
bufsize = ssh2_try_send(c);
if (bufsize == 0) {
switch (c->type) {
case CHAN_MAINSESSION:
/* stdin need not receive an unthrottle
* notification since it will be polled */
break;
case CHAN_X11:
x11_unthrottle(c->u.x11.s);
break;
case CHAN_AGENT:
/* agent sockets are request/response and need no
* buffer management */
break;
case CHAN_SOCKDATA:
pfd_unthrottle(c->u.pfd.s);
break;
}
}
}
} }
} }