summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/deno_tcp.ts11
-rw-r--r--tools/deno_tcp_proxy.ts11
2 files changed, 6 insertions, 16 deletions
diff --git a/tools/deno_tcp.ts b/tools/deno_tcp.ts
index 2b259cd38..13ebe76af 100644
--- a/tools/deno_tcp.ts
+++ b/tools/deno_tcp.ts
@@ -24,12 +24,7 @@ async function handle(conn: Deno.Conn): Promise<void> {
}
}
-async function main(): Promise<void> {
- console.log("Listening on", addr);
- while (true) {
- const conn = await listener.accept();
- handle(conn);
- }
+console.log("Listening on", addr);
+for await (const conn of listener) {
+ handle(conn);
}
-
-main();
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();