From 1944f93dd5ee0cd409ca77146a6e06a4f9e0e4ba Mon Sep 17 00:00:00 2001 From: Hlib Kanunnikov Date: Thu, 13 Jul 2023 14:23:00 +0200 Subject: [PATCH] fix(fraudserv): stop topics on Stop (#1) There was a blocker on the node side to implement this, but we have a solution for it now --- fraudserv/service.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fraudserv/service.go b/fraudserv/service.go index db5188f..ec44501 100644 --- a/fraudserv/service.go +++ b/fraudserv/service.go @@ -109,6 +109,12 @@ func (f *ProofService) Start(context.Context) error { // Stop removes the stream handler and cancels the underlying ProofService func (f *ProofService) Stop(context.Context) (err error) { f.host.RemoveStreamHandler(protocolID(f.networkID)) + f.topicsLk.Lock() + for tp, topic := range f.topics { + delete(f.topics, tp) + err = errors.Join(topic.Close()) + } + f.topicsLk.Unlock() f.cancel() return }