1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-30 16:40:57 -05:00
denoland-deno/ops/optimizer_tests/op_state_warning.rs

10 lines
364 B
Rust
Raw Normal View History

fn op_listen(state: &mut OpState) -> Result<ResourceId, Error> {
log::debug!("listen");
let addr = "127.0.0.1:4570".parse::<SocketAddr>().unwrap();
let std_listener = std::net::TcpListener::bind(&addr)?;
std_listener.set_nonblocking(true)?;
let listener = TcpListener::try_from(std_listener)?;
let rid = state.resource_table.add(listener);
Ok(rid)
}