From c56f2e0fc04f12d3a69c1892d8866323995f3be4 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sat, 13 Apr 2024 01:15:38 +0530 Subject: chore: upgrade deno_core to 0.274.0 (#23344) Signed-off-by: Divy Srivastava --- ext/net/ops.rs | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'ext/net') diff --git a/ext/net/ops.rs b/ext/net/ops.rs index a25b6c310..535e4b0cb 100644 --- a/ext/net/ops.rs +++ b/ext/net/ops.rs @@ -295,6 +295,17 @@ pub async fn op_net_connect_tcp( state: Rc>, #[serde] addr: IpAddr, ) -> Result<(ResourceId, IpAddr, IpAddr), AnyError> +where + NP: NetPermissions + 'static, +{ + op_net_connect_tcp_inner::(state, addr).await +} + +#[inline] +pub async fn op_net_connect_tcp_inner( + state: Rc>, + addr: IpAddr, +) -> Result<(ResourceId, IpAddr, IpAddr), AnyError> where NP: NetPermissions + 'static, { @@ -626,6 +637,15 @@ pub fn op_set_nodelay( state: &mut OpState, #[smi] rid: ResourceId, nodelay: bool, +) -> Result<(), AnyError> { + op_set_nodelay_inner(state, rid, nodelay) +} + +#[inline] +pub fn op_set_nodelay_inner( + state: &mut OpState, + rid: ResourceId, + nodelay: bool, ) -> Result<(), AnyError> { let resource: Rc = state.resource_table.get::(rid)?; @@ -637,6 +657,15 @@ pub fn op_set_keepalive( state: &mut OpState, #[smi] rid: ResourceId, keepalive: bool, +) -> Result<(), AnyError> { + op_set_keepalive_inner(state, rid, keepalive) +} + +#[inline] +pub fn op_set_keepalive_inner( + state: &mut OpState, + rid: ResourceId, + keepalive: bool, ) -> Result<(), AnyError> { let resource: Rc = state.resource_table.get::(rid)?; @@ -969,7 +998,7 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn tcp_set_no_delay() { let set_nodelay = Box::new(|state: &mut OpState, rid| { - op_set_nodelay::call(state, rid, true).unwrap(); + op_set_nodelay_inner(state, rid, true).unwrap(); }); let test_fn = Box::new(|socket: SockRef| { assert!(socket.nodelay().unwrap()); @@ -981,7 +1010,7 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn tcp_set_keepalive() { let set_keepalive = Box::new(|state: &mut OpState, rid| { - op_set_keepalive::call(state, rid, true).unwrap(); + op_set_keepalive_inner(state, rid, true).unwrap(); }); let test_fn = Box::new(|socket: SockRef| { assert!(!socket.nodelay().unwrap()); @@ -1032,7 +1061,7 @@ mod tests { }; let mut connect_fut = - op_net_connect_tcp::::call(conn_state, ip_addr) + op_net_connect_tcp_inner::(conn_state, ip_addr) .boxed_local(); let mut rid = None; -- cgit v1.2.3