MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / compute_preopen_sockets

Method compute_preopen_sockets

src/common.rs:409–421  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

407 }
408
409 pub fn compute_preopen_sockets(&self) -> Result<Vec<TcpListener>> {
410 let mut listeners = vec![];
411
412 for address in &self.common.wasi.tcplisten {
413 let stdlistener = std::net::TcpListener::bind(address)
414 .with_context(|| format!("failed to bind to address '{address}'"))?;
415
416 let _ = stdlistener.set_nonblocking(true)?;
417
418 listeners.push(stdlistener)
419 }
420 Ok(listeners)
421 }
422
423 pub fn validate_p3_option(&self) -> Result<()> {
424 let p3 = self.common.wasi.p3.unwrap_or(P3_DEFAULT);

Callers 2

configure_wasip2Method · 0.80
set_legacy_p1_ctxMethod · 0.80

Calls 3

OkFunction · 0.85
with_contextMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected