1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-09 23:28:06 -05:00

Don't treat plug_closing() and plug_receive() as returning backlog.

plug_receive() and plug_closing() return 0 or 1 depending on whether
they think the main connection has closed.  It is not appropriate, as
handle_gotdata and handle_socket_unfreeze did, to treat them as
returning a backlog.  In fact, plugs are unusual in PuTTY in not
reporting a backlog, but just calling into the socket to freeze and
unfreeze it as required.
This commit is contained in:
Ben Harris 2016-06-04 15:42:06 +01:00
parent a2fb1d96ef
commit 0d9c7d82e8

View File

@ -54,10 +54,11 @@ static int handle_gotdata(struct handle *h, void *data, int len)
Handle_Socket ps = (Handle_Socket) handle_get_privdata(h);
if (len < 0) {
return plug_closing(ps->plug, "Read error from handle",
0, 0);
plug_closing(ps->plug, "Read error from handle", 0, 0);
return 0;
} else if (len == 0) {
return plug_closing(ps->plug, NULL, 0, 0);
plug_closing(ps->plug, NULL, 0, 0);
return 0;
} else {
assert(ps->frozen != FROZEN && ps->frozen != THAWING);
if (ps->frozen == FREEZING) {
@ -76,7 +77,8 @@ static int handle_gotdata(struct handle *h, void *data, int len)
*/
return INT_MAX;
} else {
return plug_receive(ps->plug, 0, data, len);
plug_receive(ps->plug, 0, data, len);
return 0;
}
}
}
@ -168,7 +170,7 @@ static void handle_socket_unfreeze(void *psv)
{
Handle_Socket ps = (Handle_Socket) psv;
void *data;
int len, new_backlog;
int len;
/*
* If we've been put into a state other than THAWING since the
@ -188,7 +190,7 @@ static void handle_socket_unfreeze(void *psv)
* have the effect of trying to close this socket.
*/
ps->defer_close = TRUE;
new_backlog = plug_receive(ps->plug, 0, data, len);
plug_receive(ps->plug, 0, data, len);
bufchain_consume(&ps->inputdata, len);
ps->defer_close = FALSE;
if (ps->deferred_close) {
@ -207,7 +209,7 @@ static void handle_socket_unfreeze(void *psv)
* Otherwise, we've successfully thawed!
*/
ps->frozen = UNFROZEN;
handle_unthrottle(ps->recv_h, new_backlog);
handle_unthrottle(ps->recv_h, 0);
}
}