about summary refs log tree commit diff stats
path: root/src/buffer
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-04-30 12:19:24 +0200
committerbptato <nincsnevem662@gmail.com>2023-04-30 12:19:24 +0200
commita02c408f933aea6f405ed3c64ab151b01b33ae9e (patch)
tree4946f6b13da782a92a1ecc0f03402abacf2614b3 /src/buffer
parent05b64a1d8fa95381d756231f665c0b8c79787b67 (diff)
downloadchawan-a02c408f933aea6f405ed3c64ab151b01b33ae9e.tar.gz
WIP fetch
Diffstat (limited to 'src/buffer')
-rw-r--r--src/buffer/buffer.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim
index 5aec73df..85034d9e 100644
--- a/src/buffer/buffer.nim
+++ b/src/buffer/buffer.nim
@@ -1146,6 +1146,15 @@ proc runBuffer(buffer: Buffer, rfd: int) =
             buffer.onload()
           else:
             assert false
+        elif event.fd in buffer.loader.connecting:
+          if Event.Read in event.events:
+            buffer.loader.onConnected(event.fd)
+          else:
+            # probably shouldn't happen. TODO: maybe with Error?
+            assert false
+        elif event.fd in buffer.loader.ongoing:
+          #TODO something with readablestream?
+          discard
         elif event.fd in buffer.timeouts:
           if Event.Timer in event.events:
             buffer.selector.unregister(event.fd)
@@ -1180,6 +1189,7 @@ proc launchBuffer*(config: BufferConfig, source: BufferSource,
   )
   buffer.readbufsize = BufferSize
   buffer.selector = newSelector[int]()
+  loader.registerFun = proc(fd: int) = buffer.selector.registerHandle(fd, {Read}, 0)
   buffer.srenderer = newStreamRenderer(buffer.sstream)
   if buffer.config.scripting:
     buffer.window = newWindow(buffer.config.scripting, some(buffer.loader))