Maybe, especially if there is a way to have a TCP FIN sent without the need of poll_shutdown. However, that does not seem to be the case when a normal Framed is split normally (as seen on wireshark). This is where CleanFramedShutdown comes to the rescue. The goal is to recombine the Sink/Stream into the Framed structure when both the wrapped Sink/Stream drop, then it calls poll_shutdown on the Framed structure
Edit: I moved this to a new thread.
Yes, according to a test I just ran, the TCP stream closes successfully (using SinkExt::close). Aside from requiring to be executed in an async reactor, is there a reason why
SinkExt::close isn't called when a
close is an async method, and
Drop cannot run async methods.
If it's possible to make a sync version of
close (maybe signal using something similar to
futures::channel::oneshot::Sender::send), that would make it easier for downstream coders
There are generally no good solutions to async drop. For example with
Framed, the close call involves first flushing any data in the buffer before actually closing it.