But does the switch finish, when the client closes the connection, or are we leaking everything inside the daemon fiber in that case?
If Cohttp_eio.Server.respond finishes (either successfully or by raising an exception such as Connection_reset), the switch will cancel the daemon fiber and everything gets freed.
(but it looks to me like cohttp-eio will only notice that the connection is closed when doing a write, so it probably won’t notice until the next time the daemon fiber tries to send something)