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

Method sock_wait_for_io_with_timeout

crates/stdlib/src/ssl.rs:2623–2650  ·  view source on GitHub ↗

Internal implementation with explicit timeout override

(
            &self,
            kind: SelectKind,
            timeout: Option<core::time::Duration>,
            vm: &VirtualMachine,
        )

Source from the content-addressed store, hash-verified

2621
2622 // Internal implementation with explicit timeout override
2623 pub(crate) fn sock_wait_for_io_with_timeout(
2624 &self,
2625 kind: SelectKind,
2626 timeout: Option<core::time::Duration>,
2627 vm: &VirtualMachine,
2628 ) -> PyResult<bool> {
2629 if self.is_bio_mode() {
2630 // BIO mode doesn't use select
2631 return Ok(false);
2632 }
2633
2634 if let Some(t) = timeout
2635 && t.is_zero()
2636 {
2637 // Non-blocking mode - don't use select
2638 return Ok(false);
2639 }
2640
2641 let py_socket: PyRef<PySocket> = self.sock.clone().try_into_value(vm)?;
2642 let socket = py_socket
2643 .sock()
2644 .map_err(|e| vm.new_os_error(format!("Failed to get socket: {e}")))?;
2645
2646 let timed_out = sock_select(&socket, kind, timeout)
2647 .map_err(|e| vm.new_os_error(format!("select failed: {e}")))?;
2648
2649 Ok(timed_out)
2650 }
2651
2652 // SNI (Server Name Indication) Helper Methods:
2653 // These methods support the server-side handshake SNI callback mechanism

Callers 2

shutdownMethod · 0.80
send_all_bytesFunction · 0.80

Calls 7

sock_selectFunction · 0.85
is_bio_modeMethod · 0.80
try_into_valueMethod · 0.80
sockMethod · 0.80
new_os_errorMethod · 0.80
is_zeroMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected