Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING(net): remove Deno.DatagramConn.rid #22475

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 12 additions & 16 deletions ext/net/01_net.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,59 +372,55 @@ class Datagram {
this.bufSize = bufSize;
}

get rid() {
return this.#rid;
}

get addr() {
return this.#addr;
}

async joinMulticastV4(addr, multiInterface) {
await op_net_join_multi_v4_udp(
this.rid,
this.#rid,
addr,
multiInterface,
);

return {
leave: () =>
op_net_leave_multi_v4_udp(
this.rid,
this.#rid,
addr,
multiInterface,
),
setLoopback: (loopback) =>
op_net_set_multi_loopback_udp(
this.rid,
this.#rid,
true,
loopback,
),
setTTL: (ttl) =>
op_net_set_multi_ttl_udp(
this.rid,
this.#rid,
ttl,
),
};
}

async joinMulticastV6(addr, multiInterface) {
await op_net_join_multi_v6_udp(
this.rid,
this.#rid,
addr,
multiInterface,
);

return {
leave: () =>
op_net_leave_multi_v6_udp(
this.rid,
this.#rid,
addr,
multiInterface,
),
setLoopback: (loopback) =>
op_net_set_multi_loopback_udp(
this.rid,
this.#rid,
false,
loopback,
),
Expand All @@ -438,7 +434,7 @@ class Datagram {
switch (this.addr.transport) {
case "udp": {
this.#promise = op_net_recv_udp(
this.rid,
this.#rid,
buf,
);
if (this.#unref) core.unrefOpPromise(this.#promise);
Expand All @@ -449,7 +445,7 @@ class Datagram {
case "unixpacket": {
let path;
({ 0: nread, 1: path } = await op_net_recv_unixpacket(
this.rid,
this.#rid,
buf,
));
remoteAddr = { transport: "unixpacket", path };
Expand All @@ -466,13 +462,13 @@ class Datagram {
switch (this.addr.transport) {
case "udp":
return await op_net_send_udp(
this.rid,
this.#rid,
{ hostname: opts.hostname ?? "127.0.0.1", port: opts.port },
p,
);
case "unixpacket":
return await op_net_send_unixpacket(
this.rid,
this.#rid,
opts.path,
p,
);
Expand All @@ -482,7 +478,7 @@ class Datagram {
}

close() {
core.close(this.rid);
core.close(this.#rid);
}

ref() {
Expand Down