about summary refs log tree commit diff stats
path: root/src/local/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-07-06 15:58:39 +0200
committerbptato <nincsnevem662@gmail.com>2024-07-06 16:03:11 +0200
commit7184a6758340451b7f8161487b0c4ce1f979510d (patch)
tree3e05fafba80515ab7b3b8a4fc6938169647f77d8 /src/local/client.nim
parentf0d7c5982acd1cf510c6834682c880c6fa78ebb0 (diff)
downloadchawan-7184a6758340451b7f8161487b0c4ce1f979510d.tar.gz
main, forkserver: optimize startup
Merge "load config" with "fork loader", so that the loader process gets
forked one packet earlier.
Diffstat (limited to 'src/local/client.nim')
-rw-r--r--src/local/client.nim11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/local/client.nim b/src/local/client.nim
index ad4bfaff..ebe9910d 100644
--- a/src/local/client.nim
+++ b/src/local/client.nim
@@ -822,19 +822,12 @@ proc addJSModules(client: Client; ctx: JSContext) =
 func getClient(client: Client): Client {.jsfget: "client".} =
   return client
 
-proc newClient*(config: Config; forkserver: ForkServer; jsctx: JSContext;
-    warnings: seq[string]): Client =
+proc newClient*(config: Config; forkserver: ForkServer; loaderPid: int;
+    jsctx: JSContext; warnings: seq[string]): Client =
   setControlCHook(proc() {.noconv.} = quit(1))
   let jsrt = JS_GetRuntime(jsctx)
   JS_SetModuleLoaderFunc(jsrt, normalizeModuleName, clientLoadJSModule, nil)
   let pager = newPager(config, forkserver, jsctx, warnings)
-  let loaderPid = forkserver.forkLoader(LoaderConfig(
-    urimethodmap: config.external.urimethodmap,
-    w3mCGICompat: config.external.w3m_cgi_compat,
-    cgiDir: seq[string](config.external.cgi_dir),
-    tmpdir: config.external.tmpdir,
-    sockdir: config.external.sockdir
-  ))
   let loader = FileLoader(process: loaderPid, clientPid: getCurrentProcessId())
   loader.setSocketDir(config.external.sockdir)
   pager.setLoader(loader)