From 5d08473d86c2c9020215934c9630e20032752e2c Mon Sep 17 00:00:00 2001 From: Christian Ulrich Date: Mon, 27 Jul 2020 23:51:16 +0200 Subject: [PATCH] userSock may be closed in handleRequest, so check before recvLine --- punchd.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/punchd.nim b/punchd.nim index 9f124f8..8c35839 100644 --- a/punchd.nim +++ b/punchd.nim @@ -64,6 +64,8 @@ proc handleRequest(line: string, unixSock: AsyncSocket) {.async.} = proc handleRequests(userSock: AsyncSocket) {.async.} = while true: + if userSock.isClosed: + break let line = await userSock.recvLine(maxLength = 400) if line.len == 0: break