about summary refs log tree commit diff stats
path: root/src/loader/loaderhandle.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-24 14:12:27 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-24 14:21:01 +0100
commitfb21b1e4f0ee0e55e9556bf1f399d00d5eae26e4 (patch)
treec532aa98ee6bedf19b840f4ea0c7360a42407fbf /src/loader/loaderhandle.nim
parentb27deb7672c53e3ee59f91b7091e83ab28a8318d (diff)
downloadchawan-fb21b1e4f0ee0e55e9556bf1f399d00d5eae26e4.tar.gz
io: derive DynStream from RootObj (not Stream)
This way they are no longer compatible, but we no longer need them to
be compatible anyway.

(This also forces us to throw out the old serialize module, and use
packet writers everywhere.)
Diffstat (limited to 'src/loader/loaderhandle.nim')
-rw-r--r--src/loader/loaderhandle.nim11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/loader/loaderhandle.nim b/src/loader/loaderhandle.nim
index 6e1b53a9..00f6f754 100644
--- a/src/loader/loaderhandle.nim
+++ b/src/loader/loaderhandle.nim
@@ -1,6 +1,5 @@
 import std/deques
 import std/net
-import std/streams
 import std/tables
 
 import io/bufwriter
@@ -129,7 +128,7 @@ proc sendResult*(handle: LoaderHandle; res: int; msg = "") =
   let output = handle.output
   let blocking = output.ostream.blocking
   output.ostream.setBlocking(true)
-  output.ostream.withWriter w:
+  output.ostream.withPacketWriter w:
     w.swrite(res)
     if res == 0: # success
       assert msg == ""
@@ -143,7 +142,7 @@ proc sendStatus*(handle: LoaderHandle; status: uint16) =
   inc handle.rstate
   let blocking = handle.output.ostream.blocking
   handle.output.ostream.setBlocking(true)
-  handle.output.ostream.withWriter w:
+  handle.output.ostream.withPacketWriter w:
     w.swrite(status)
   handle.output.ostream.setBlocking(blocking)
 
@@ -152,7 +151,7 @@ proc sendHeaders*(handle: LoaderHandle; headers: Headers) =
   inc handle.rstate
   let blocking = handle.output.ostream.blocking
   handle.output.ostream.setBlocking(true)
-  handle.output.ostream.withWriter w:
+  handle.output.ostream.withPacketWriter w:
     w.swrite(headers)
   handle.output.ostream.setBlocking(blocking)
 
@@ -169,8 +168,8 @@ proc close*(handle: LoaderHandle) =
   for output in handle.outputs:
     #TODO assert not output.registered
     if output.ostream != nil:
-      output.ostream.close()
+      output.ostream.sclose()
       output.ostream = nil
   if handle.istream != nil:
-    handle.istream.close()
+    handle.istream.sclose()
     handle.istream = nil