MCPcopy Index your code
hub / github.com/RustPython/RustPython / write_pending_tls

Method write_pending_tls

crates/stdlib/src/ssl.rs:4271–4295  ·  view source on GitHub ↗

Helper: Write all pending TLS data (including close_notify) to outgoing buffer/BIO

(&self, conn: &mut TlsConnection, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

4269
4270 // Helper: Write all pending TLS data (including close_notify) to outgoing buffer/BIO
4271 fn write_pending_tls(&self, conn: &mut TlsConnection, vm: &VirtualMachine) -> PyResult<()> {
4272 // First, flush any previously pending TLS output
4273 // Must succeed before sending new data to maintain order
4274 self.flush_pending_tls_output(vm, None)?;
4275
4276 loop {
4277 if !conn.wants_write() {
4278 break;
4279 }
4280
4281 let mut buf = vec![0u8; SSL3_RT_MAX_PLAIN_LENGTH];
4282 let written = conn
4283 .write_tls(&mut buf.as_mut_slice())
4284 .map_err(|e| vm.new_os_error(format!("TLS write failed: {e}")))?;
4285
4286 if written == 0 {
4287 break;
4288 }
4289
4290 // Send TLS data, saving unsent bytes to pending buffer if needed
4291 self.send_tls_output(buf[..written].to_vec(), vm)?;
4292 }
4293
4294 Ok(())
4295 }
4296
4297 // Helper: Try to read incoming data from socket/BIO
4298 // Returns true if peer closed connection (with or without close_notify)

Callers 1

shutdownMethod · 0.80

Calls 7

wants_writeMethod · 0.80
write_tlsMethod · 0.80
new_os_errorMethod · 0.80
send_tls_outputMethod · 0.80
to_vecMethod · 0.80
as_mut_sliceMethod · 0.45

Tested by

no test coverage detected