public inbox for nncp-devel@lists.cypherpunks.ru
Atom feed
* [PATCH] Check before closing potentially nil channel
@ 2022-10-28 15:05 Emery Hemingway
  2022-10-30 15:31 ` Sergey Matveev
  0 siblings, 1 reply; 2+ messages in thread
From: Emery Hemingway @ 2022-10-28 15:05 UTC (permalink / raw)
  To: nncp-devel; +Cc: Emery Hemingway

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-30 15:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 15:05 [PATCH] Check before closing potentially nil channel Emery Hemingway
2022-10-30 15:31 ` Sergey Matveev