This fixes a race condition where a quick forced socket close will make getpeername to fail and connected == False. If the request then has an error close_after_flush is set and this will result in a 100% CPU loop.
This wiil ensure the channel is still closed in this case.
TODO:
[x] add some more specific tests for double close
[x] test for closing a error request thats not connected
[x] test for maintainance not cleaning up an unconnected task
[ ] change the fix to only prevent write specifically when already closed, not when not connected
fixes #418
This fixes a race condition where a quick forced socket close will make getpeername to fail and connected == False. If the request then has an error close_after_flush is set and this will result in a 100% CPU loop. This wiil ensure the channel is still closed in this case.
TODO: