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

Function recv_one_tls_record_for_data

crates/stdlib/src/ssl/compat.rs:1245–1269  ·  view source on GitHub ↗

Read a single TLS record for post-handshake I/O while preserving the SSL-vs-socket error precedence from the old sock_recv() path.

(
    conn: &mut TlsConnection,
    socket: &PySSLSocket,
    vm: &VirtualMachine,
)

Source from the content-addressed store, hash-verified

1243/// Read a single TLS record for post-handshake I/O while preserving the
1244/// SSL-vs-socket error precedence from the old sock_recv() path.
1245fn recv_one_tls_record_for_data(
1246 conn: &mut TlsConnection,
1247 socket: &PySSLSocket,
1248 vm: &VirtualMachine,
1249) -> SslResult<PyObjectRef> {
1250 match recv_one_tls_record(socket, vm) {
1251 Ok(data) => Ok(data),
1252 Err(SslError::Eof) => {
1253 if let Err(rustls_err) = conn.process_new_packets() {
1254 return Err(SslError::from_rustls(rustls_err));
1255 }
1256 Ok(vm.ctx.new_bytes(vec![]).into())
1257 }
1258 Err(SslError::Py(e)) => {
1259 if let Err(rustls_err) = conn.process_new_packets() {
1260 return Err(SslError::from_rustls(rustls_err));
1261 }
1262 if is_connection_closed_error(&e, vm) {
1263 return Err(SslError::Eof);
1264 }
1265 Err(SslError::Py(e))
1266 }
1267 Err(e) => Err(e),
1268 }
1269}
1270
1271fn handshake_read_data(
1272 conn: &mut TlsConnection,

Callers 2

ssl_readFunction · 0.85

Calls 6

recv_one_tls_recordFunction · 0.85
PyClass · 0.85
process_new_packetsMethod · 0.80
ErrClass · 0.50
new_bytesMethod · 0.45

Tested by

no test coverage detected