From b292b4f92d4c7537093e9b0daa009ee24db7b325 Mon Sep 17 00:00:00 2001 From: Zsolt Felfoldi Date: Thu, 6 Jun 2024 15:43:13 +0200 Subject: [PATCH] beacon/light/request: unlock server mutex while unsubscribing from parent --- beacon/light/request/server.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/beacon/light/request/server.go b/beacon/light/request/server.go index dc5c46ad39..a06dec99ae 100644 --- a/beacon/light/request/server.go +++ b/beacon/light/request/server.go @@ -230,13 +230,12 @@ func (s *serverWithTimeout) startTimeout(reqData RequestResponse) { // unsubscribe stops all goroutines associated with the server. func (s *serverWithTimeout) unsubscribe() { s.lock.Lock() - defer s.lock.Unlock() - for _, timer := range s.timeouts { if timer != nil { timer.Stop() } } + s.lock.Unlock() s.parent.Unsubscribe() } @@ -354,13 +353,12 @@ func (s *serverWithLimits) sendRequest(request Request) (reqId ID) { // unsubscribe stops all goroutines associated with the server. func (s *serverWithLimits) unsubscribe() { s.lock.Lock() - defer s.lock.Unlock() - if s.delayTimer != nil { s.delayTimer.Stop() s.delayTimer = nil } s.childEventCb = nil + s.lock.Unlock() s.serverWithTimeout.unsubscribe() }