summaryrefslogtreecommitdiff
path: root/ext/net/ops.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/net/ops.rs')
-rw-r--r--ext/net/ops.rs33
1 files changed, 30 insertions, 3 deletions
diff --git a/ext/net/ops.rs b/ext/net/ops.rs
index e6420bf9e..96de8cff1 100644
--- a/ext/net/ops.rs
+++ b/ext/net/ops.rs
@@ -53,10 +53,13 @@ pub fn init<P: NetPermissions + 'static>() -> Vec<OpDecl> {
crate::ops_unix::op_net_connect_unix::decl::<P>(),
op_net_listen_tcp::decl::<P>(),
op_net_listen_udp::decl::<P>(),
+ op_node_unstable_net_listen_udp::decl::<P>(),
#[cfg(unix)]
crate::ops_unix::op_net_listen_unix::decl::<P>(),
#[cfg(unix)]
crate::ops_unix::op_net_listen_unixpacket::decl::<P>(),
+ #[cfg(unix)]
+ crate::ops_unix::op_node_unstable_net_listen_unixpacket::decl::<P>(),
op_net_recv_udp::decl(),
#[cfg(unix)]
crate::ops_unix::op_net_recv_unixpacket::decl(),
@@ -288,8 +291,7 @@ where
Ok((rid, IpAddr::from(local_addr)))
}
-#[op]
-fn op_net_listen_udp<NP>(
+fn net_listen_udp<NP>(
state: &mut OpState,
addr: IpAddr,
reuse_address: bool,
@@ -297,7 +299,6 @@ fn op_net_listen_udp<NP>(
where
NP: NetPermissions + 'static,
{
- super::check_unstable(state, "Deno.listenDatagram");
state
.borrow_mut::<NP>()
.check_net(&(&addr.hostname, Some(addr.port)), "Deno.listenDatagram()")?;
@@ -343,6 +344,32 @@ where
Ok((rid, IpAddr::from(local_addr)))
}
+#[op]
+fn op_net_listen_udp<NP>(
+ state: &mut OpState,
+ addr: IpAddr,
+ reuse_address: bool,
+) -> Result<(ResourceId, IpAddr), AnyError>
+where
+ NP: NetPermissions + 'static,
+{
+ super::check_unstable(state, "Deno.listenDatagram");
+ net_listen_udp::<NP>(state, addr, reuse_address)
+}
+
+#[op]
+fn op_node_unstable_net_listen_udp<NP>(
+ state: &mut OpState,
+ addr: IpAddr,
+ reuse_address: bool,
+) -> Result<(ResourceId, IpAddr), AnyError>
+where
+ NP: NetPermissions + 'static,
+{
+ super::check_unstable(state, "Deno.listenDatagram");
+ net_listen_udp::<NP>(state, addr, reuse_address)
+}
+
#[derive(Serialize, Eq, PartialEq, Debug)]
#[serde(untagged)]
pub enum DnsReturnRecord {