Conversation
| where | ||
| IO: AsyncRead + AsyncWrite + Unpin, | ||
| { | ||
| fn poll_write_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>]) -> Poll<Result<usize, Error>> { |
There was a problem hiding this comment.
Also process early_data and provide tests.
There was a problem hiding this comment.
Can you give me some guidance on how to best write tests for this? There are quite a few edge cases that would need testing and I am unsure how to do that.
There was a problem hiding this comment.
You can refer to https://github.com/rustls/tokio-rustls/blob/main/tests/early-data.rs .
because early rustls does not support server-side early_data, only limited testing can be done with openssl. now we should be able to use rustls for testing.
b2e5ca7 to
19657f2
Compare
| // If we didn't write the entire buffer, return early. | ||
| if len != buf.len() { | ||
| return Poll::Ready(Ok(written)); | ||
| } |
There was a problem hiding this comment.
I am not sure this is entirely correct. We will be called again because we returned Poll::Ready, ending up in an endless loop because len will probably be 0 and we thus won't ever get out of this.
Perhaps we shouldn't bother with looping over bufs and just only write the first non-empty buffer? As long as we return Poll::Ready, any caller should call us again until we return Poll::Pending.
There was a problem hiding this comment.
If early_data write returns 0, it means the early_data buffer is full and we should break out of loop and try handshake.
I agree that it is safe to just write to first non-empty buf and have no preference for this.
|
|
||
| while self.session.wants_write() { | ||
| match self.write_io(cx) { | ||
| Poll::Ready(Ok(0)) | Poll::Pending => return Poll::Pending, |
|
Superseded by #45. |
Early draft implementation to collect feedback. Also missing tests! Would appreciate some guidance on how to best test this (and perhaps avoid some code duplication?).
Resolves: #26.