diff options
author | Andy Hayden <andyhayden1@gmail.com> | 2019-10-28 12:58:35 -0700 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2019-10-28 15:58:35 -0400 |
commit | f484776384ad7df35ab7626b7a673f3902a6cfaa (patch) | |
tree | cb74f31550dc666ec75f5a2f95d61dc69931cb16 /tools/deno_tcp_proxy.ts | |
parent | 71efe6f2c530d1cb9e8a2679f5778e2c034a9d0d (diff) |
Use top-level for-await in various places (#3217)
Diffstat (limited to 'tools/deno_tcp_proxy.ts')
-rw-r--r-- | tools/deno_tcp_proxy.ts | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/tools/deno_tcp_proxy.ts b/tools/deno_tcp_proxy.ts index 23d219071..487825648 100644 --- a/tools/deno_tcp_proxy.ts +++ b/tools/deno_tcp_proxy.ts @@ -24,12 +24,7 @@ async function handle(conn: Deno.Conn): Promise<void> { } } -async function main(): Promise<void> { - console.log(`Proxy listening on http://${addr}/`); - while (true) { - const conn = await listener.accept(); - handle(conn); - } +console.log(`Proxy listening on http://${addr}/`); +for await (const conn of listener) { + handle(conn); } - -main(); |