summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal_binding/stream_wrap.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/polyfills/internal_binding/stream_wrap.ts')
-rw-r--r--ext/node/polyfills/internal_binding/stream_wrap.ts13
1 files changed, 6 insertions, 7 deletions
diff --git a/ext/node/polyfills/internal_binding/stream_wrap.ts b/ext/node/polyfills/internal_binding/stream_wrap.ts
index 8480a7d64..d568803bf 100644
--- a/ext/node/polyfills/internal_binding/stream_wrap.ts
+++ b/ext/node/polyfills/internal_binding/stream_wrap.ts
@@ -31,6 +31,7 @@
// deno-lint-ignore-file prefer-primordials
import { core } from "ext:core/mod.js";
+const { internalRidSymbol } = core;
const {
op_can_write_vectored,
op_raw_write_vectored,
@@ -46,8 +47,6 @@ 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>;
}
@@ -205,7 +204,7 @@ export class LibuvStreamWrap extends HandleWrap {
allBuffers: boolean,
): number {
const supportsWritev = this.provider === providerType.TCPSERVERWRAP;
- const rid = this[kStreamBaseField]![DENO_RID_SYMBOL];
+ const rid = this[kStreamBaseField]![internalRidSymbol];
// Fast case optimization: two chunks, and all buffers.
if (
chunks.length === 2 && allBuffers && supportsWritev &&
@@ -319,14 +318,14 @@ export class LibuvStreamWrap extends HandleWrap {
async #read() {
let buf = this.#buf;
let nread: number | null;
- const ridBefore = this[kStreamBaseField]![DENO_RID_SYMBOL];
+ const ridBefore = this[kStreamBaseField]![internalRidSymbol];
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]![DENO_RID_SYMBOL]
+ ridBefore != this[kStreamBaseField]![internalRidSymbol]
) {
return this.#read();
}
@@ -377,7 +376,7 @@ export class LibuvStreamWrap extends HandleWrap {
async #write(req: WriteWrap<LibuvStreamWrap>, data: Uint8Array) {
const { byteLength } = data;
- const ridBefore = this[kStreamBaseField]![DENO_RID_SYMBOL];
+ const ridBefore = this[kStreamBaseField]![internalRidSymbol];
let nwritten = 0;
try {
@@ -391,7 +390,7 @@ export class LibuvStreamWrap extends HandleWrap {
// Try to read again if the underlying stream resource
// changed. This can happen during TLS upgrades (eg. STARTTLS)
if (
- ridBefore != this[kStreamBaseField]![DENO_RID_SYMBOL]
+ ridBefore != this[kStreamBaseField]![internalRidSymbol]
) {
return this.#write(req, data.subarray(nwritten));
}