public inbox for nncp-devel@lists.cypherpunks.ru
Atom feed
From: Emery Hemingway <ehmry@posteo•net>
To: nncp-devel@lists.cypherpunks.ru
Cc: Emery Hemingway <ehmry@posteo•net>
Subject: [PATCH] Check before closing potentially nil channel
Date: Fri, 28 Oct 2022 15:05:24 +0000 [thread overview]
Message-ID: <1666969366.c6f2phfxws.astroid@zuni.home.arpa> (raw)
I had a problem here when the nncp-daemon starts up with while being
spammed by new connection requests.
---
src/cmd/nncp-daemon/main.go | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/cmd/nncp-daemon/main.go b/src/cmd/nncp-daemon/main.go
index 710b687..39b25c4 100644
--- a/src/cmd/nncp-daemon/main.go
+++ b/src/cmd/nncp-daemon/main.go
@@ -310,7 +310,9 @@ func main() {
}
<-nodeIdC // call completion
if *autoToss {
- close(autoTossFinish)
+ if autoTossFinish != nil {
+ close(autoTossFinish)
+ }
<-autoTossBadCode
}
conn.Close()
--
2.37.3
next reply other threads:[~2022-10-28 15:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 15:05 Emery Hemingway [this message]
2022-10-30 15:31 ` [PATCH] Check before closing potentially nil channel Sergey Matveev