From eaa9dd1fb0e9373efa70682eeb9cf39669267ccb Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sat, 27 Apr 2019 21:32:48 +0300 Subject: [PATCH] Stop goroutine when state is dead --- src/cypherpunks.ru/nncp/sp.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cypherpunks.ru/nncp/sp.go b/src/cypherpunks.ru/nncp/sp.go index fdfb14a..e309b98 100644 --- a/src/cypherpunks.ru/nncp/sp.go +++ b/src/cypherpunks.ru/nncp/sp.go @@ -546,6 +546,9 @@ func (state *SPState) StartWorkers( if state.xxOnly == "" || state.xxOnly == TTx { go func() { for range time.Tick(time.Second) { + if state.NotAlive() { + return + } for _, payload := range state.ctx.infosOur( state.Node.Id, state.nice, -- 2.44.0