summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/http.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/polyfills/http.ts')
-rw-r--r--ext/node/polyfills/http.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts
index 4ad502760..475d691cc 100644
--- a/ext/node/polyfills/http.ts
+++ b/ext/node/polyfills/http.ts
@@ -7,7 +7,6 @@
const core = globalThis.__bootstrap.core;
import { TextEncoder } from "ext:deno_web/08_text_encoding.js";
-import { type Deferred, deferred } from "ext:deno_node/_util/async.ts";
import { setTimeout } from "ext:deno_web/02_timers.js";
import {
_normalizeArgs,
@@ -1556,7 +1555,7 @@ export class ServerImpl extends EventEmitter {
#server: Deno.Server;
#unref = false;
#ac?: AbortController;
- #servePromise: Deferred<void>;
+ #serveDeferred: ReturnType<typeof Promise.withResolvers<void>>;
listening = false;
constructor(opts, requestListener?: ServerHandler) {
@@ -1573,8 +1572,8 @@ export class ServerImpl extends EventEmitter {
this._opts = opts;
- this.#servePromise = deferred();
- this.#servePromise.then(() => this.emit("close"));
+ this.#serveDeferred = Promise.withResolvers<void>();
+ this.#serveDeferred.promise.then(() => this.emit("close"));
if (requestListener !== undefined) {
this.on("request", requestListener);
}
@@ -1660,7 +1659,7 @@ export class ServerImpl extends EventEmitter {
if (this.#unref) {
this.#server.unref();
}
- this.#server.finished.then(() => this.#servePromise!.resolve());
+ this.#server.finished.then(() => this.#serveDeferred!.resolve());
}
setTimeout() {
@@ -1700,7 +1699,7 @@ export class ServerImpl extends EventEmitter {
this.#ac.abort();
this.#ac = undefined;
} else {
- this.#servePromise!.resolve();
+ this.#serveDeferred!.resolve();
}
this.#server = undefined;