about summary refs log tree commit diff stats
path: root/src/local
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-03-01 21:39:54 +0100
committerbptato <nincsnevem662@gmail.com>2025-03-01 21:39:54 +0100
commit5a080116b92d80c498ea2f4220f3b3dc1fb54abc (patch)
treefc95b147812f73774ac84e6e2665248b6a543afe /src/local
parent40b4b4febd728b48a18ed3ed6e7e7339834d7c5f (diff)
downloadchawan-5a080116b92d80c498ea2f4220f3b3dc1fb54abc.tar.gz
Refactor bufreader, bufwriter
This adds a runtime check to packet readers to ensure that all fds have
been read, and switches to seqs for packet writers.
Diffstat (limited to 'src/local')
-rw-r--r--src/local/container.nim10
-rw-r--r--src/local/pager.nim10
2 files changed, 10 insertions, 10 deletions
diff --git a/src/local/container.nim b/src/local/container.nim
index 980e95bc..3c1423f1 100644
--- a/src/local/container.nim
+++ b/src/local/container.nim
@@ -8,7 +8,7 @@ import config/config
 import config/cookie
 import config/mimetypes
 import css/render
-import io/bufwriter
+import io/packetwriter
 import io/dynstream
 import io/promise
 import local/select
@@ -247,9 +247,9 @@ proc clone*(container: Container; newurl: URL; loader: FileLoader):
     discard close(sv[1])
     return nil
   container.iface.stream.source.withPacketWriter w:
-    w.sendAux.add(sv[1])
-    w.sendAux.add(pipefd[0])
-    w.sendAux.add(pipefd[1])
+    w.sendFd(sv[1])
+    w.sendFd(pipefd[0])
+    w.sendFd(pipefd[1])
   discard close(sv[1])
   discard close(pipefd[0])
   discard close(pipefd[1])
@@ -1598,7 +1598,7 @@ proc readSuccess*(container: Container; s: string; fd: cint = -1) =
   if fd != -1:
     doAssert container.iface.stream.flush()
     container.iface.stream.source.withPacketWriter w:
-      w.sendAux.add(fd)
+      w.sendFd(fd)
   p.then(proc(res: Request) =
     if res != nil:
       container.triggerEvent(ContainerEvent(t: cetOpen, request: res))
diff --git a/src/local/pager.nim b/src/local/pager.nim
index 756f822e..0e6a0fb7 100644
--- a/src/local/pager.nim
+++ b/src/local/pager.nim
@@ -17,10 +17,10 @@ import config/mailcap
 import config/mimetypes
 import css/render
 import html/script
-import io/bufreader
-import io/bufwriter
 import io/console
 import io/dynstream
+import io/packetreader
+import io/packetwriter
 import io/poll
 import io/promise
 import io/timeout
@@ -2737,14 +2737,14 @@ proc connected3(pager: Pager; container: Container; stream: SocketStream;
       loader.resume([istreamOutputId, ostreamOutputId])
     stream.withPacketWriter w:
       w.swrite(outCacheId)
-      w.sendAux.add(cstream.fd)
+      w.sendFd(cstream.fd)
       # pass down ostream
-      w.sendAux.add(ostream.fd)
+      w.sendFd(ostream.fd)
     ostream.sclose()
     container.setStream(bufStream)
   else: # cloned buffer
     stream.withPacketWriter w:
-      w.sendAux.add(cstream.fd)
+      w.sendFd(cstream.fd)
     # buffer is cloned, just share the parent's cached source
     discard loader.shareCachedItem(container.cacheId, container.process)
     # also add a reference here; it will be removed when the container is