Go to file
Fiona Ebner fa63916921 anyevent: always avoid re-entering client_do_disconnect() in on_error callback
Commit f737984 ("fix #4816: do not disconnect twice if client sends no
data") introduced a 'disconnected' flag in the request state to avoid
duplicate calls to client_do_disconnect() for a given client. This
works, except in the case where client_do_disconnect() enters the
on_error callback itself. To fix this, set the 'disconnected' flag
before calling client_do_disconnect().

This was exposed by commit 07e56cc ("fix unexpected EOF for client
when closing TLS session") which introduced a call to stoptls() in
client_do_disconnect(). The documentation [0] mentions for stoptls():

> This method may invoke callbacks (and therefore the handle might be
> destroyed after it returns).

Indeed, the on_error callback might get invoked and lead to a
"detected empty handle" error message as reported in the community
forum [1].

[0]: https://metacpan.org/pod/AnyEvent::Handle#$handle-%3Estoptls
[1]: https://forum.proxmox.com/threads/164744/

Fixes: 07e56cc ("fix unexpected EOF for client when closing TLS session")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250408142014.86344-3-f.ebner@proxmox.com
2025-04-08 16:23:46 +02:00
debian bump version to 5.2.1 2025-04-08 14:49:50 +02:00
src anyevent: always avoid re-entering client_do_disconnect() in on_error callback 2025-04-08 16:23:46 +02:00
.gitignore fixup no newline at end of .gitignore 2018-05-25 16:42:05 +02:00
Makefile fixup! buildsys: add sbuild target for convenience 2023-05-17 07:31:38 +02:00