summaryrefslogtreecommitdiff
path: root/ext/net
diff options
context:
space:
mode:
Diffstat (limited to 'ext/net')
-rw-r--r--ext/net/01_net.js39
1 files changed, 2 insertions, 37 deletions
diff --git a/ext/net/01_net.js b/ext/net/01_net.js
index 04360116b..d7a093ba6 100644
--- a/ext/net/01_net.js
+++ b/ext/net/01_net.js
@@ -4,7 +4,8 @@
((window) => {
const core = window.Deno.core;
const { BadResourcePrototype, InterruptedPrototype, ops } = core;
- const { WritableStream, readableStreamForRid } = window.__bootstrap.streams;
+ const { readableStreamForRid, writableStreamForRid } =
+ window.__bootstrap.streams;
const {
Error,
ObjectPrototypeIsPrototypeOf,
@@ -65,39 +66,6 @@
return core.opAsync("op_dns_resolve", { query, recordType, options });
}
- function tryClose(rid) {
- try {
- core.close(rid);
- } catch {
- // Ignore errors
- }
- }
-
- function writableStreamForRid(rid) {
- return new WritableStream({
- async write(chunk, controller) {
- try {
- let nwritten = 0;
- while (nwritten < chunk.length) {
- nwritten += await write(
- rid,
- TypedArrayPrototypeSubarray(chunk, nwritten),
- );
- }
- } catch (e) {
- controller.error(e);
- tryClose(rid);
- }
- },
- close() {
- tryClose(rid);
- },
- abort() {
- tryClose(rid);
- },
- });
- }
-
class Conn {
#rid = 0;
#remoteAddr = null;
@@ -353,7 +321,4 @@
Datagram,
resolveDns,
};
- window.__bootstrap.streamUtils = {
- writableStreamForRid,
- };
})(this);