summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-05-14 15:22:50 -0400
committerGitHub <noreply@github.com>2019-05-14 15:22:50 -0400
commit160a815767fc25b0439e57ef13a1082dfb05dc99 (patch)
treefb11f9728444ff9522f08c1ba9a2838f3dde183a /tests
parent5e56e26c8baad08954cdc3ecac34923dcdc39c12 (diff)
Rename HTTP benchmarks (#2350)
Diffstat (limited to 'tests')
-rw-r--r--tests/http_bench.ts34
1 files changed, 0 insertions, 34 deletions
diff --git a/tests/http_bench.ts b/tests/http_bench.ts
deleted file mode 100644
index 5b61bd4cd..000000000
--- a/tests/http_bench.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-// Used for benchmarking Deno's networking. See tools/http_benchmark.py
-// TODO Replace this with a real HTTP server once
-// https://github.com/denoland/deno/issues/726 is completed.
-// Note: this is a keep-alive server.
-const addr = Deno.args[1] || "127.0.0.1:4500";
-const listener = Deno.listen("tcp", addr);
-const response = new TextEncoder().encode(
- "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n"
-);
-
-async function handle(conn: Deno.Conn): Promise<void> {
- const buffer = new Uint8Array(1024);
- try {
- while (true) {
- const r = await conn.read(buffer);
- if (r.eof) {
- break;
- }
- await conn.write(response);
- }
- } finally {
- conn.close();
- }
-}
-
-async function main(): Promise<void> {
- console.log("Listening on", addr);
- while (true) {
- const conn = await listener.accept();
- handle(conn);
- }
-}
-
-main();