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

Method select

crates/stdlib/src/openssl.rs:2302–2329  ·  view source on GitHub ↗
(&self, needs: SslNeeds, deadline: &SocketDeadline)

Source from the content-addressed store, hash-verified

2300 }
2301
2302 fn select(&self, needs: SslNeeds, deadline: &SocketDeadline) -> SelectRet {
2303 let sock = match self.0.sock_opt() {
2304 Some(s) => s,
2305 None => return SelectRet::Closed,
2306 };
2307 // For blocking sockets without timeout, call sock_select with None timeout
2308 // to actually block waiting for data instead of busy-looping
2309 let timeout = match &deadline {
2310 Ok(deadline) => match deadline.checked_duration_since(Instant::now()) {
2311 Some(d) => Some(d),
2312 None => return SelectRet::TimedOut,
2313 },
2314 Err(true) => None, // Blocking: no timeout, wait indefinitely
2315 Err(false) => return SelectRet::Nonblocking,
2316 };
2317 let res = socket::sock_select(
2318 &sock,
2319 match needs {
2320 SslNeeds::Read => socket::SelectKind::Read,
2321 SslNeeds::Write => socket::SelectKind::Write,
2322 },
2323 timeout,
2324 );
2325 match res {
2326 Ok(true) => SelectRet::TimedOut,
2327 _ => SelectRet::Ok,
2328 }
2329 }
2330
2331 fn socket_needs(
2332 &self,

Callers 6

socket_needsMethod · 0.45
shutdownMethod · 0.45
writeMethod · 0.45
dd_lnMethod · 0.45
dd_expMethod · 0.45
compile_ipowMethod · 0.45

Calls 3

sock_selectFunction · 0.85
sock_optMethod · 0.80
SomeClass · 0.50

Tested by

no test coverage detected