From afafcaf1047f721c8d061d883329d0e556326511 Mon Sep 17 00:00:00 2001 From: bptato Date: Thu, 29 Feb 2024 23:23:40 +0100 Subject: buffer, client: fix deadlock with send() calls This is an ancient bug, but it got much easier to trigger with mouse scrolling support so it's time to fix it. (The bug itself was that since both the client and buffer ends of the controlling stream are blocking, they could get stuck when both were trying to send() data to the other end but the buffer was full. So now we set the client end to non-blocking.) --- src/local/pager.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/local/pager.nim') diff --git a/src/local/pager.nim b/src/local/pager.nim index 1040c259..d8f7c5dd 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -21,8 +21,8 @@ import extern/editor import extern/runproc import extern/stdio import extern/tempfile +import io/posixstream import io/promise -import io/socketstream import js/error import js/javascript import js/jstypes @@ -86,7 +86,7 @@ type statusgrid*: FixedGrid term*: Terminal tmpdir: string - unreg*: seq[(Pid, SocketStream)] + unreg*: seq[(Pid, PosixStream)] urimethodmap: URIMethodMap username: string @@ -583,7 +583,7 @@ proc deleteContainer(pager: Pager, container: Container) = pager.setContainer(nil) container.parent = nil container.children.setLen(0) - pager.unreg.add((container.process, SocketStream(container.iface.stream))) + pager.unreg.add((container.process, container.iface.stream)) pager.forkserver.removeChild(container.process) proc discardBuffer(pager: Pager, container = none(Container)) {.jsfunc.} = -- cgit 1.4.1-2-gfad0