connection_handle_write_impl mishandles TOR_TLS_WANT_WRITE
Reported pseudonymously:
It appears that connection_handle_write_impl exits quickly when it hears TOR_TLS_WANT_WRITE from flush_from_buf_tls. But flush_from_buf_tls can return that error code even when it has flushed some data. That means that the other code in that function -- like decrementing buckets and calling flushed_some functions -- might not get called at all.
I'm attaching the suggested patch; I think the patch could actually be even simpler.
This could be a backport candidate for 0.2.3.