summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal_binding
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-01-26 00:36:03 +0100
committerGitHub <noreply@github.com>2024-01-26 00:36:03 +0100
commit9951506506ded805ff5eb09b52fb0235c0c3df79 (patch)
tree97be72e40de6c221d7db328433053bc17a6933ba /ext/node/polyfills/internal_binding
parent0b0fb94ce2489da642cffd82e0498446d4a1fe1f (diff)
fix(node): remove deprecation warnings (#22120)
Closes https://github.com/denoland/deno/issues/22116
Diffstat (limited to 'ext/node/polyfills/internal_binding')
-rw-r--r--ext/node/polyfills/internal_binding/stream_wrap.ts16
1 files changed, 11 insertions, 5 deletions
diff --git a/ext/node/polyfills/internal_binding/stream_wrap.ts b/ext/node/polyfills/internal_binding/stream_wrap.ts
index 87371bf7a..8480a7d64 100644
--- a/ext/node/polyfills/internal_binding/stream_wrap.ts
+++ b/ext/node/polyfills/internal_binding/stream_wrap.ts
@@ -46,6 +46,8 @@ import {
} from "ext:deno_node/internal_binding/async_wrap.ts";
import { codeMap } from "ext:deno_node/internal_binding/uv.ts";
+const DENO_RID_SYMBOL = Symbol.for("Deno.internal.rid");
+
interface Reader {
read(p: Uint8Array): Promise<number | null>;
}
@@ -203,7 +205,7 @@ export class LibuvStreamWrap extends HandleWrap {
allBuffers: boolean,
): number {
const supportsWritev = this.provider === providerType.TCPSERVERWRAP;
- const rid = this[kStreamBaseField]!.rid;
+ const rid = this[kStreamBaseField]![DENO_RID_SYMBOL];
// Fast case optimization: two chunks, and all buffers.
if (
chunks.length === 2 && allBuffers && supportsWritev &&
@@ -317,13 +319,15 @@ export class LibuvStreamWrap extends HandleWrap {
async #read() {
let buf = this.#buf;
let nread: number | null;
- const ridBefore = this[kStreamBaseField]!.rid;
+ const ridBefore = this[kStreamBaseField]![DENO_RID_SYMBOL];
try {
nread = await this[kStreamBaseField]!.read(buf);
} catch (e) {
// Try to read again if the underlying stream resource
// changed. This can happen during TLS upgrades (eg. STARTTLS)
- if (ridBefore != this[kStreamBaseField]!.rid) {
+ if (
+ ridBefore != this[kStreamBaseField]![DENO_RID_SYMBOL]
+ ) {
return this.#read();
}
@@ -373,7 +377,7 @@ export class LibuvStreamWrap extends HandleWrap {
async #write(req: WriteWrap<LibuvStreamWrap>, data: Uint8Array) {
const { byteLength } = data;
- const ridBefore = this[kStreamBaseField]!.rid;
+ const ridBefore = this[kStreamBaseField]![DENO_RID_SYMBOL];
let nwritten = 0;
try {
@@ -386,7 +390,9 @@ export class LibuvStreamWrap extends HandleWrap {
} catch (e) {
// Try to read again if the underlying stream resource
// changed. This can happen during TLS upgrades (eg. STARTTLS)
- if (ridBefore != this[kStreamBaseField]!.rid) {
+ if (
+ ridBefore != this[kStreamBaseField]![DENO_RID_SYMBOL]
+ ) {
return this.#write(req, data.subarray(nwritten));
}