about summary refs log tree commit diff stats
path: root/src/loader
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-09-14 21:20:02 +0200
committerbptato <nincsnevem662@gmail.com>2024-09-14 21:21:34 +0200
commit11d102e2ba16f8f4a9976ab81d35b22da5c0ad2f (patch)
tree4f2296c51973bc6a14dcabe7c366f9a7023b7589 /src/loader
parent5b2a36579e53c69f154288a91ddc3e7c5375d7a6 (diff)
downloadchawan-11d102e2ba16f8f4a9976ab81d35b22da5c0ad2f.tar.gz
loader: improve map interface
directly accessing map was a bit too error prone
Diffstat (limited to 'src/loader')
-rw-r--r--src/loader/loader.nim11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/loader/loader.nim b/src/loader/loader.nim
index 0816c6f8..2b846fb5 100644
--- a/src/loader/loader.nim
+++ b/src/loader/loader.nim
@@ -60,7 +60,7 @@ type
     key*: ClientKey
     process*: int
     clientPid*: int
-    map*: seq[LoaderData]
+    map: seq[LoaderData]
     mapFds*: int # number of fds in map
     unregistered*: seq[int]
     registerFun*: proc(fd: int)
@@ -1060,9 +1060,14 @@ proc startRequest*(loader: FileLoader; request: Request;
     w.swrite(config)
   return stream
 
-iterator ongoing*(loader: FileLoader): OngoingData =
+iterator data*(loader: FileLoader): LoaderData {.inline.} =
   for it in loader.map:
-    if it != nil and it of OngoingData:
+    if it != nil:
+      yield it
+
+iterator ongoing*(loader: FileLoader): OngoingData {.inline.} =
+  for it in loader.data:
+    if it of OngoingData:
       yield OngoingData(it)
 
 func fd*(data: LoaderData): int =