mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Mark handles defunct before calling gotdata/sentdata.
If (say) a read handle returns EOF, and its gotdata function responds by calling handle_free(), then we want the handle to have already had its defunct flag set so that the handle can be destroyed. Otherwise handle_free will set the 'done' flag to ask the subthread to terminate, and then sit and wait for it to say it's done so - forgetting that it signalled termination already by returning EOF, and hence will not be responding to that signal. Ditto for write errors on write handles, though that should happen less often.
This commit is contained in:
parent
7549f2da40
commit
087ca595f3
@ -629,8 +629,8 @@ void handle_got_event(HANDLE event)
|
||||
/*
|
||||
* EOF, or (nearly equivalently) read error.
|
||||
*/
|
||||
h->u.i.gotdata(h, NULL, -h->u.i.readerr);
|
||||
h->u.i.defunct = TRUE;
|
||||
h->u.i.gotdata(h, NULL, -h->u.i.readerr);
|
||||
} else {
|
||||
backlog = h->u.i.gotdata(h, h->u.i.buffer, h->u.i.len);
|
||||
handle_throttle(&h->u.i, backlog);
|
||||
@ -651,8 +651,8 @@ void handle_got_event(HANDLE event)
|
||||
* and mark the thread as defunct (because the output
|
||||
* thread is terminating by now).
|
||||
*/
|
||||
h->u.o.sentdata(h, -h->u.o.writeerr);
|
||||
h->u.o.defunct = TRUE;
|
||||
h->u.o.sentdata(h, -h->u.o.writeerr);
|
||||
} else {
|
||||
bufchain_consume(&h->u.o.queued_data, h->u.o.lenwritten);
|
||||
h->u.o.sentdata(h, bufchain_size(&h->u.o.queued_data));
|
||||
|
Loading…
Reference in New Issue
Block a user