FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

flush on WantWrite by youknowone · Pull Request #6717 · RustPython/RustPython · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rs  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
12 changes: 9 additions & 3 deletions crates/stdlib/src/ssl/compat.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1237,16 +1237,21 @@ fn handle_handshake_complete(
}
} else if conn.wants_write() {
// Send all pending data (e.g., TLS 1.3 NewSessionTicket) to socket
// Best-effort: WantWrite means socket buffer full, pending data will be
// sent in subsequent read/write calls. Don't fail handshake for this.
// Must drain ALL rustls buffer - don't break on WantWrite
while conn.wants_write() {
let tls_data = ssl_write_tls_records(conn)?;
if tls_data.is_empty() {
break;
}
match send_all_bytes(socket, tls_data, vm, None) {
Ok(()) => {}
Err(SslError::WantWrite) => break,
Err(SslError::WantWrite) => {
// Socket buffer full, data saved to pending_tls_output
// Flush pending and continue draining rustls buffer
socket
.blocking_flush_all_pending(vm)
.map_err(SslError::Py)?;
}
Err(e) => return Err(e),
}
}
Expand All @@ -1256,6 +1261,7 @@ fn handle_handshake_complete(
// TLS 1.3 Finished must reach server before handshake is considered complete
// Without this, server may not process application data
if !socket.is_bio_mode() {
// Flush pending_tls_output to ensure all TLS data reaches the server
socket
.blocking_flush_all_pending(vm)
.map_err(SslError::Py)?;
Expand Down
Loading

Back | FazBrowse Home | New Git URL