Open
Description
Noticed while working on #823: normally, if you try to call send_eof
on an object at the same time that another task is already calling send_all
or wait_send_all_might_not_block
, then send_eof
should raise BusyResourceError
. But StapledStream.send_eof
calls self.send_stream.aclose
, which has a different semantics: it interrupts any pending calls. So right now StapledStream.send_eof
has the wrong semantics.
To solve this, StapledStream
should detect when another task is already calling a send method, and in that case make send_eof
raise an exception instead of calling self.send_stream.aclose
.
I have a fix for this in my #823 branch, that I'll post shortly.