Internal implementation with explicit timeout override
(
&self,
kind: SelectKind,
timeout: Option<core::time::Duration>,
vm: &VirtualMachine,
)
| 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 |
no test coverage detected