Commit 8333a99e authored by protolambda's avatar protolambda

op-node: log shutdown before releasing client waitgroup

parent 3589cb98
...@@ -268,11 +268,11 @@ func (s *SyncClient) Start() { ...@@ -268,11 +268,11 @@ func (s *SyncClient) Start() {
func (s *SyncClient) AddPeer(id peer.ID) { func (s *SyncClient) AddPeer(id peer.ID) {
s.peersLock.Lock() s.peersLock.Lock()
defer s.peersLock.Unlock() defer s.peersLock.Unlock()
if _, ok := s.peers[id]; ok { if s.closingPeers {
s.log.Warn("cannot register peer for sync duties, peer was already registered", "peer", id)
return return
} }
if s.closingPeers { if _, ok := s.peers[id]; ok {
s.log.Warn("cannot register peer for sync duties, peer was already registered", "peer", id)
return return
} }
s.wg.Add(1) s.wg.Add(1)
...@@ -492,9 +492,9 @@ func (s *SyncClient) peerLoop(ctx context.Context, id peer.ID) { ...@@ -492,9 +492,9 @@ func (s *SyncClient) peerLoop(ctx context.Context, id peer.ID) {
defer func() { defer func() {
s.peersLock.Lock() s.peersLock.Lock()
delete(s.peers, id) // clean up delete(s.peers, id) // clean up
s.log.Debug("stopped syncing loop of peer", "id", id)
s.wg.Done() s.wg.Done()
s.peersLock.Unlock() s.peersLock.Unlock()
s.log.Debug("stopped syncing loop of peer", "id", id)
}() }()
log := s.log.New("peer", id) log := s.log.New("peer", id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment