summaryrefslogtreecommitdiff
path: root/core/http_bench.js
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2019-03-10 04:30:38 +1100
committerRyan Dahl <ry@tinyclouds.org>2019-03-09 12:30:38 -0500
commit034e2cc02829c9244b32232074c7a48af827a2fb (patch)
treebade01606a1ee076c1f753ce99c97ddb1e4edf30 /core/http_bench.js
parent8c7a12d1b258f0ef5ab27f49c424331d43e8d97f (diff)
Migrate from tslint to eslint for linting (#1905)
Diffstat (limited to 'core/http_bench.js')
-rw-r--r--core/http_bench.js34
1 files changed, 17 insertions, 17 deletions
diff --git a/core/http_bench.js b/core/http_bench.js
index b9615e689..29a79c436 100644
--- a/core/http_bench.js
+++ b/core/http_bench.js
@@ -39,6 +39,20 @@ function createResolvable() {
return Object.assign(promise, methods);
}
+function setRecord(i, off, value) {
+ if (i >= NUM_RECORDS) {
+ throw Error("out of range");
+ }
+ shared32[INDEX_RECORDS + RECORD_SIZE * i + off] = value;
+}
+
+function getRecord(i, off) {
+ if (i >= NUM_RECORDS) {
+ throw Error("out of range");
+ }
+ return shared32[INDEX_RECORDS + RECORD_SIZE * i + off];
+}
+
/** Returns Promise<number> */
function sendAsync(op, arg, zeroCopyData) {
const id = nextPromiseId++;
@@ -64,20 +78,6 @@ function sendSync(op, arg) {
return getRecord(0, RECORD_OFFSET_RESULT);
}
-function setRecord(i, off, value) {
- if (i >= NUM_RECORDS) {
- throw Error("out of range");
- }
- shared32[INDEX_RECORDS + RECORD_SIZE * i + off] = value;
-}
-
-function getRecord(i, off) {
- if (i >= NUM_RECORDS) {
- throw Error("out of range");
- }
- return shared32[INDEX_RECORDS + RECORD_SIZE * i + off];
-}
-
function handleAsyncMsgFromRust() {
for (let i = 0; i < shared32[INDEX_NUM_RECORDS]; i++) {
let id = getRecord(i, RECORD_OFFSET_PROMISE_ID);
@@ -134,10 +134,10 @@ async function main() {
libdeno.print("http_bench.js start");
- const listener_rid = listen();
- libdeno.print(`listening http://127.0.0.1:4544/ rid = ${listener_rid}`);
+ const listenerRid = listen();
+ libdeno.print(`listening http://127.0.0.1:4544/ rid = ${listenerRid}`);
while (true) {
- const rid = await accept(listener_rid);
+ const rid = await accept(listenerRid);
// libdeno.print(`accepted ${rid}`);
if (rid < 0) {
libdeno.print(`accept error ${rid}`);