diff options
author | crowlKats <13135287+crowlKats@users.noreply.github.com> | 2021-03-19 01:55:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 20:55:31 -0400 |
commit | 197305908b721340041be03e5a11fe60a1711fb2 (patch) | |
tree | 732f63ef3d14c174e0eb5e29414ab57ccc232dbd /runtime/ops/net.rs | |
parent | 277e19f4d26b66bbba99b0a3d6539b524dc88830 (diff) |
normalize rids (#9832)
Diffstat (limited to 'runtime/ops/net.rs')
-rw-r--r-- | runtime/ops/net.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/runtime/ops/net.rs b/runtime/ops/net.rs index c3714e33c..012b5b8ef 100644 --- a/runtime/ops/net.rs +++ b/runtime/ops/net.rs @@ -55,7 +55,7 @@ pub fn init(rt: &mut deno_core::JsRuntime) { #[derive(Deserialize)] pub(crate) struct AcceptArgs { - pub rid: i32, + pub rid: u32, pub transport: String, } @@ -64,7 +64,7 @@ async fn accept_tcp( args: AcceptArgs, _zero_copy: BufVec, ) -> Result<Value, AnyError> { - let rid = args.rid as u32; + let rid = args.rid; let resource = state .borrow() @@ -125,7 +125,7 @@ async fn op_accept( #[derive(Deserialize)] pub(crate) struct ReceiveArgs { - pub rid: i32, + pub rid: u32, pub transport: String, } @@ -137,7 +137,7 @@ async fn receive_udp( assert_eq!(zero_copy.len(), 1, "Invalid number of arguments"); let mut zero_copy = zero_copy[0].clone(); - let rid = args.rid as u32; + let rid = args.rid; let resource = state .borrow_mut() @@ -181,7 +181,7 @@ async fn op_datagram_receive( #[derive(Deserialize)] struct SendArgs { - rid: i32, + rid: u32, transport: String, #[serde(flatten)] transport_args: ArgsEnum, @@ -215,7 +215,7 @@ async fn op_datagram_send( let resource = state .borrow_mut() .resource_table - .get::<UdpSocketResource>(rid as u32) + .get::<UdpSocketResource>(rid) .ok_or_else(|| bad_resource("Socket has been closed"))?; let socket = RcRef::map(&resource, |r| &r.socket).borrow().await; let byte_length = socket.send_to(&zero_copy, &addr).await?; @@ -235,7 +235,7 @@ async fn op_datagram_send( let resource = state .borrow() .resource_table - .get::<net_unix::UnixDatagramResource>(rid as u32) + .get::<net_unix::UnixDatagramResource>(rid) .ok_or_else(|| { custom_error("NotConnected", "Socket has been closed") })?; |