mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Merge pull request #173 from bhandras/hotfix
loopd: add missing mutex unlock and fix subtle reace condition
This commit is contained in:
commit
605d3ac60b
1 changed files with 2 additions and 1 deletions
|
|
@ -190,10 +190,10 @@ func (s *swapClientServer) Monitor(in *looprpc.MonitorRequest,
|
|||
s.swapsLock.Unlock()
|
||||
|
||||
defer func() {
|
||||
queue.Stop()
|
||||
s.swapsLock.Lock()
|
||||
delete(s.subscribers, id)
|
||||
s.swapsLock.Unlock()
|
||||
queue.Stop()
|
||||
}()
|
||||
|
||||
// Sort completed swaps new to old.
|
||||
|
|
@ -459,6 +459,7 @@ func (s *swapClientServer) processStatusUpdates(mainCtx context.Context) {
|
|||
select {
|
||||
case subscriber <- swp:
|
||||
case <-mainCtx.Done():
|
||||
s.swapsLock.Unlock()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue