mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
parent
f5097d9d3b
commit
abaffad028
2 changed files with 15 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
import { core, primordials } from "ext:core/mod.js";
|
import { core, internals, primordials } from "ext:core/mod.js";
|
||||||
const {
|
const {
|
||||||
BadResourcePrototype,
|
BadResourcePrototype,
|
||||||
InterruptedPrototype,
|
InterruptedPrototype,
|
||||||
|
@ -216,6 +216,11 @@ class Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
get rid() {
|
get rid() {
|
||||||
|
internals.warnOnDeprecatedApi(
|
||||||
|
"Deno.Listener.rid",
|
||||||
|
new Error().stack,
|
||||||
|
"Use `Deno.Listener` instance methods instead.",
|
||||||
|
);
|
||||||
return this.#rid;
|
return this.#rid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,10 +232,10 @@ class Listener {
|
||||||
let promise;
|
let promise;
|
||||||
switch (this.addr.transport) {
|
switch (this.addr.transport) {
|
||||||
case "tcp":
|
case "tcp":
|
||||||
promise = op_net_accept_tcp(this.rid);
|
promise = op_net_accept_tcp(this.#rid);
|
||||||
break;
|
break;
|
||||||
case "unix":
|
case "unix":
|
||||||
promise = op_net_accept_unix(this.rid);
|
promise = op_net_accept_unix(this.#rid);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unsupported transport: ${this.addr.transport}`);
|
throw new Error(`Unsupported transport: ${this.addr.transport}`);
|
||||||
|
@ -276,7 +281,7 @@ class Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
core.close(this.rid);
|
core.close(this.#rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
[SymbolDispose]() {
|
[SymbolDispose]() {
|
||||||
|
|
7
ext/net/lib.deno_net.d.ts
vendored
7
ext/net/lib.deno_net.d.ts
vendored
|
@ -35,7 +35,12 @@ declare namespace Deno {
|
||||||
/** Return the address of the `Listener`. */
|
/** Return the address of the `Listener`. */
|
||||||
readonly addr: Addr;
|
readonly addr: Addr;
|
||||||
|
|
||||||
/** Return the rid of the `Listener`. */
|
/**
|
||||||
|
* Return the rid of the `Listener`.
|
||||||
|
*
|
||||||
|
* @deprecated Use {@linkcode Deno.Listener} instance methods instead.
|
||||||
|
* {@linkcode Deno.Listener.rid} will be removed in Deno 2.0.
|
||||||
|
*/
|
||||||
readonly rid: number;
|
readonly rid: number;
|
||||||
|
|
||||||
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
||||||
|
|
Loading…
Add table
Reference in a new issue