diff options
| author | Nayeem Rahman <muhammed.9939@gmail.com> | 2019-11-09 19:40:22 +0000 |
|---|---|---|
| committer | Ry Dahl <ry@tinyclouds.org> | 2019-11-09 14:40:22 -0500 |
| commit | d586f119fa588a590a4ba2b74c8c210de710e3e7 (patch) | |
| tree | 0a6a249c46c70c8326221ad79fb4e7fc739dc488 /std/http/server.ts | |
| parent | 9889a28008eb9da1793bb9987bafe0b4952dd90a (diff) | |
net: Check for closing status when iterating Listener (#3309)
std/http/server.ts: Use listener.next() instead of listener.accept()
Diffstat (limited to 'std/http/server.ts')
| -rw-r--r-- | std/http/server.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/std/http/server.ts b/std/http/server.ts index deedb0f12..ce32511b1 100644 --- a/std/http/server.ts +++ b/std/http/server.ts @@ -371,7 +371,9 @@ export class Server implements AsyncIterable<ServerRequest> { ): AsyncIterableIterator<ServerRequest> { if (this.closing) return; // Wait for a new connection. - const conn = await this.listener.accept(); + const { value, done } = await this.listener.next(); + if (done) return; + const conn = value as Conn; // Try to accept another connection and add it to the multiplexer. mux.add(this.acceptConnAndIterateHttpRequests(mux)); // Yield the requests that arrive on the just-accepted connection. |
