MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / poll_next

Method poll_next

crates/openshell-driver-vm/src/main.rs:442–464  ·  view source on GitHub ↗
(self: Pin<&mut Self>, cx: &mut Context<'_>)

Source from the content-addressed store, hash-verified

440 type Item = io::Result<UnixStream>;
441
442 fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
443 let this = self.get_mut();
444 loop {
445 match this.listener.poll_accept(cx) {
446 Poll::Ready(Ok((stream, _addr))) => {
447 let authorized = peer_credentials(&stream).and_then(|peer| {
448 authorize_peer_credentials(peer, this.expected_uid, this.expected_peer_pid)
449 });
450 match authorized {
451 Ok(()) => return Poll::Ready(Some(Ok(stream))),
452 Err(err) => {
453 tracing::warn!(
454 error = %err,
455 "rejected vm compute driver UDS client"
456 );
457 }
458 }
459 }
460 Poll::Ready(Err(err)) => return Poll::Ready(Some(Err(err))),
461 Poll::Pending => return Poll::Pending,
462 }
463 }
464 }
465}
466
467fn build_vm_launch_config(args: &Args) -> std::result::Result<VmLaunchConfig, String> {

Callers

nothing calls this directly

Calls 2

peer_credentialsFunction · 0.85

Tested by

no test coverage detected