Repository navigation
fix: handshake does not fully flush writes - #112
Conversation
|
Thank you! That makes sense. about early data, I think you can put the |
Thanks. I've changed to this and added a test for early_data, and checked that it timed-out before and works after the change. |
|
Can you clean this up into atomic commits so that it becomes a bit easier to review? |
ec49b6b to
5003c89
Compare
|
@djc done. |
| pub fn handshake( | ||
| &mut self, | ||
| cx: &mut Context, | ||
| mut need_flush: bool, |
There was a problem hiding this comment.
I was thinking of make need_flush a field of Stream struct. but this is good enough.
There was a problem hiding this comment.
Changed to that. Wdyt?
|
@conradludgate this needs a rebase. If you want to turn |
5003c89 to
d8fed93
Compare
|
Thank you! |
* write test to verify that flush does not get resumed * attempt to persist the need_flush state during handshake
@almindor pointed out a potential issue with poll_flush within handshake. If write returns Ready, but flush returns Pending, it's guaranteed that the
handshake()function returns and loses theneed_flushstate. If there's no more data to write, then it will never attempt to flush or write again.Given the nature of TLS, it could be the client hello still needs flushing before a server hello would ever be readable.
This normally wouldn't be observable against a TcpStream, given that TcpStream has no flush impl.
The first commit creates a test that currently times out. The second commit introduces a potential fix which caches the
need_flushstate.I'm not sure what to do about early-data handling.