mirror of https://github.com/ctz/rustls
60cfb9b4cf
Previously, calls to `complete_io()` may return as if handshaking has completed, but leave pending TLS writes queued that won't be sent until a subsequent call to `complete_io()` is made. This happens because `is_handshaking()` can begin to return false after calls to `process_new_packets()` while there are final handshake packets put in the connection's buffers, but not yet extracted to be sent to the peer. The end result is that calling `complete_io()` once is not sufficient to fully complete a handshake with a peer. A second call was required to flush the pending packets. In this commit the `complete_io()` logic is updated to continue processing IO when calling `process_new_packets()` has queued TLS writes, only returning to the caller when all pending IO has been dealt with and the handshake truly completed. We can test this behaviour by updating the `client_complete_io_for_handshake` and `server_complete_io_for_handshake` unit tests to assert there are no pending TLS writes after calling `complete_io()`. Prior to this commit these assertions would fail, and with the updated logic they pass as expected. |
||
---|---|---|
.. | ||
common | ||
api.rs | ||
bogo.rs | ||
client_cert_verifier.rs | ||
key_log_file_env.rs | ||
server_cert_verifier.rs |