From 612747f19dd0c4a51726f9d966d2c0d4e7c8dd39 Mon Sep 17 00:00:00 2001 From: Roman Volosatovs Date: Wed, 25 Jan 2023 16:57:34 +0100 Subject: [PATCH] wasmtime: default to blocking sockets This commit is a follow-up on f81a663da7846ebf8a41282ef60b1eaf3c834e89, in which pre-opened socket support was added, but sockets opened by wasmtime were made to default to non-blocking mode and pre-opened sockets passed to wasmtime via `listenfd` were explicitly set to non-blocking mode. Avoid explicitly setting the mode and use OS default mode in the former case or whichever mode was pre-configured in the latter. Note, that Windows, POSIX and Berkeley sockets are blocking by default. Signed-off-by: Roman Volosatovs --- src/commands/run.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/commands/run.rs b/src/commands/run.rs index 81c724bd7c48..0488a1691d3b 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -250,9 +250,6 @@ impl RunCommand { for address in &self.run.common.wasi.tcplisten { let stdlistener = std::net::TcpListener::bind(address) .with_context(|| format!("failed to bind to address '{}'", address))?; - - let _ = stdlistener.set_nonblocking(true)?; - listeners.push(TcpListener::from_std(stdlistener)) } Ok(listeners) @@ -874,7 +871,6 @@ fn ctx_set_listenfd(mut num_fd: usize, builder: &mut WasiCtxBuilder) -> Result