mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix(ext/node): implement dgram setBroadcast (#29195)
This commit is contained in:
parent
d67da9d4e7
commit
802826e54e
7 changed files with 71 additions and 4 deletions
|
@ -390,6 +390,23 @@ pub async fn op_net_set_multi_ttl_udp(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[op2(async)]
|
||||
pub async fn op_net_set_broadcast_udp(
|
||||
state: Rc<RefCell<OpState>>,
|
||||
#[smi] rid: ResourceId,
|
||||
broadcast: bool,
|
||||
) -> Result<(), NetError> {
|
||||
let resource = state
|
||||
.borrow_mut()
|
||||
.resource_table
|
||||
.get::<UdpSocketResource>(rid)
|
||||
.map_err(|_| NetError::SocketClosed)?;
|
||||
let socket = RcRef::map(&resource, |r| &r.socket).borrow().await;
|
||||
socket.set_broadcast(broadcast)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// If this token is present in op_net_connect_tcp call and
|
||||
/// the hostname matches with one of the resolved IPs, then
|
||||
/// the permission check is performed against the original hostname.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue