about summary refs log tree commit diff stats
path: root/src/local/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-05-16 18:35:22 +0200
committerbptato <nincsnevem662@gmail.com>2024-05-16 18:58:13 +0200
commited84d7223fd8945705dcedd204fee137b249c524 (patch)
tree3539b9ccb5af2de6ad66e6d3362bff83abc1df88 /src/local/client.nim
parent87a5c636eb203cd066a620129f93c30b02245ad9 (diff)
downloadchawan-ed84d7223fd8945705dcedd204fee137b249c524.tar.gz
config: separate tmp dir for sockets, users
* add $LOGNAME to the tmp directory name, so that tmpdirs of separate
  users don't conflict
* use separate directory for sockets, so that we do not have to give
  buffers access to all cached pages
Diffstat (limited to 'src/local/client.nim')
-rw-r--r--src/local/client.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/local/client.nim b/src/local/client.nim
index f5e722e3..07a7c523 100644
--- a/src/local/client.nim
+++ b/src/local/client.nim
@@ -427,10 +427,10 @@ proc acceptBuffers(client: Client) =
     client.selector.registerHandle(fd, {Read, Write}, 0)
   for item in pager.procmap:
     let container = item.container
-    let stream = connectSocketStream(client.config.external.tmpdir,
+    let stream = connectSocketStream(client.config.external.sockdir,
       client.loader.sockDirFd, container.process)
     # unlink here; on Linux we can't unlink from the buffer :/
-    discard tryRemoveFile(getSocketPath(client.config.external.tmpdir,
+    discard tryRemoveFile(getSocketPath(client.config.external.sockdir,
       container.process))
     if stream == nil:
       pager.alert("Error: failed to set up buffer")
@@ -838,10 +838,11 @@ proc newClient*(config: Config; forkserver: ForkServer; jsctx: JSContext;
     urimethodmap: config.external.urimethodmap,
     w3mCGICompat: config.external.w3m_cgi_compat,
     cgiDir: seq[string](config.external.cgi_dir),
-    tmpdir: config.external.tmpdir
+    tmpdir: config.external.tmpdir,
+    sockdir: config.external.sockdir
   ))
   let loader = FileLoader(process: loaderPid, clientPid: getCurrentProcessId())
-  loader.setSocketDir(config.external.tmpdir)
+  loader.setSocketDir(config.external.sockdir)
   pager.setLoader(loader)
   let client = Client(
     config: config,