summaryrefslogtreecommitdiff
path: root/runtime/rt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/rt')
-rw-r--r--runtime/rt/30_net.js32
-rw-r--r--runtime/rt/40_fs_events.js2
-rw-r--r--runtime/rt/40_signals.js11
3 files changed, 19 insertions, 26 deletions
diff --git a/runtime/rt/30_net.js b/runtime/rt/30_net.js
index 9a71f0693..7009f6f8d 100644
--- a/runtime/rt/30_net.js
+++ b/runtime/rt/30_net.js
@@ -11,20 +11,16 @@
0: "Read",
1: "Write",
2: "ReadWrite",
- Read: 0,
+ Read: 0, // TODO: nonsense, remove me.
Write: 1,
ReadWrite: 2, // unused
};
function shutdown(rid, how) {
- core.jsonOpSync("op_shutdown", { rid, how });
- return Promise.resolve();
+ return core.jsonOpAsync("op_shutdown", { rid, how });
}
- function opAccept(
- rid,
- transport,
- ) {
+ function opAccept(rid, transport) {
return core.jsonOpAsync("op_accept", { rid, transport });
}
@@ -36,11 +32,7 @@
return core.jsonOpAsync("op_connect", args);
}
- function opReceive(
- rid,
- transport,
- zeroCopy,
- ) {
+ function opReceive(rid, transport, zeroCopy) {
return core.jsonOpAsync(
"op_datagram_receive",
{ rid, transport },
@@ -56,11 +48,7 @@
#rid = 0;
#remoteAddr = null;
#localAddr = null;
- constructor(
- rid,
- remoteAddr,
- localAddr,
- ) {
+ constructor(rid, remoteAddr, localAddr) {
this.#rid = rid;
this.#remoteAddr = remoteAddr;
this.#localAddr = localAddr;
@@ -149,11 +137,7 @@
#rid = 0;
#addr = null;
- constructor(
- rid,
- addr,
- bufSize = 1024,
- ) {
+ constructor(rid, addr, bufSize = 1024) {
this.#rid = rid;
this.#addr = addr;
this.bufSize = bufSize;
@@ -213,9 +197,7 @@
return new Listener(res.rid, res.localAddr);
}
- async function connect(
- options,
- ) {
+ async function connect(options) {
let res;
if (options.transport === "unix") {
diff --git a/runtime/rt/40_fs_events.js b/runtime/rt/40_fs_events.js
index a36adecba..a179e8c1b 100644
--- a/runtime/rt/40_fs_events.js
+++ b/runtime/rt/40_fs_events.js
@@ -24,6 +24,8 @@
} catch (error) {
if (error instanceof errors.BadResource) {
return { value: undefined, done: true };
+ } else if (error instanceof errors.Interrupted) {
+ return { value: undefined, done: true };
}
throw error;
}
diff --git a/runtime/rt/40_signals.js b/runtime/rt/40_signals.js
index 739c963fd..091afd66a 100644
--- a/runtime/rt/40_signals.js
+++ b/runtime/rt/40_signals.js
@@ -3,6 +3,7 @@
((window) => {
const core = window.Deno.core;
const { build } = window.__bootstrap.build;
+ const { errors } = window.__bootstrap.errors;
function bindSignal(signo) {
return core.jsonOpSync("op_signal_bind", { signo });
@@ -212,7 +213,15 @@
}
#pollSignal = async () => {
- const res = await pollSignal(this.#rid);
+ let res;
+ try {
+ res = await pollSignal(this.#rid);
+ } catch (error) {
+ if (error instanceof errors.BadResource) {
+ return true;
+ }
+ throw error;
+ }
return res.done;
};