summaryrefslogtreecommitdiff
path: root/cli/rt/30_net.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-09-16 22:22:43 +0200
committerGitHub <noreply@github.com>2020-09-16 22:22:43 +0200
commit6c4da0e429eb47dae6a220c5576a39f137615bb8 (patch)
treea8715428caea00105acc9a10fcd0f356085d3fa7 /cli/rt/30_net.js
parent104aebdfb5d01f7482bacef6d58c2ce16da44334 (diff)
refactor: remove dispatch_json.js from cli/rt and cli/tsc (#7521)
Instead use Deno.core.jsonOpSync and Deno.core.jsonOpAsync
Diffstat (limited to 'cli/rt/30_net.js')
-rw-r--r--cli/rt/30_net.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/cli/rt/30_net.js b/cli/rt/30_net.js
index 78d8b3276..8c3dcb4ba 100644
--- a/cli/rt/30_net.js
+++ b/cli/rt/30_net.js
@@ -1,10 +1,10 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
((window) => {
+ const core = window.Deno.core;
const { errors } = window.__bootstrap.errors;
const { read, write } = window.__bootstrap.io;
const { close } = window.__bootstrap.resources;
- const { sendSync, sendAsync } = window.__bootstrap.dispatchJson;
const ShutdownMode = {
// See http://man7.org/linux/man-pages/man2/shutdown.2.html
@@ -18,7 +18,7 @@
};
function shutdown(rid, how) {
- sendSync("op_shutdown", { rid, how });
+ core.jsonOpSync("op_shutdown", { rid, how });
return Promise.resolve();
}
@@ -26,15 +26,15 @@
rid,
transport,
) {
- return sendAsync("op_accept", { rid, transport });
+ return core.jsonOpAsync("op_accept", { rid, transport });
}
function opListen(args) {
- return sendSync("op_listen", args);
+ return core.jsonOpSync("op_listen", args);
}
function opConnect(args) {
- return sendAsync("op_connect", args);
+ return core.jsonOpAsync("op_connect", args);
}
function opReceive(
@@ -42,11 +42,15 @@
transport,
zeroCopy,
) {
- return sendAsync("op_datagram_receive", { rid, transport }, zeroCopy);
+ return core.jsonOpAsync(
+ "op_datagram_receive",
+ { rid, transport },
+ zeroCopy,
+ );
}
function opSend(args, zeroCopy) {
- return sendAsync("op_datagram_send", args, zeroCopy);
+ return core.jsonOpAsync("op_datagram_send", args, zeroCopy);
}
class Conn {