What steps will reproduce the problem?
- I'm not exactly sure how to best trigger this.
- For some reason not understood yet this did not happen in our software stack in the past.
What is the expected output?
- net.http.server calls response:on_destroy only once for a given response/connection.
What do you see instead?
- It is sometimes called twice (could possibly be even more often, as listerner.ondisconnect seems to be possibly called multiple times.
What version of the product are you using? On what operating system?
Prosody 0.11.8 Linux
Please provide any additional information below.
1. Here it works:
response.finished is checked, also response.on_destroy is set to nil
2. Here it does not work (although re-invocation via 1. is prevented):
This sets .finished, but, when invoked multiple times (which does happen, I'm just not sure, how to best reproduce this), will call on_destroy *each time*. Any module code (in our case, a custom mod_eventsource provider used by a custom event logging module) hooking on_destroy has no benefit from being called multiple times.