proto: Make StreamTarget::close() misuse less likely.
It turns out that we can make IncomingStream::reject()
consume
self, thus making it impossible to hit the double-close error
from outside the tor-proto
crate.
Also, we rename StreamTarget::close()
to close_pending()
to
better reflect its limited applicability.
While working on this, I found #1065 (closed), which isn't so great; it may be that this is not the right approach. I'm sharing this branch anyway since:
- At least it isn't a step backwards.
- It demonstrates an API direction in
IncomingStream
that might help us solve #1065 (closed).
Edited by Nick Mathewson