Skip to content

Commit

Permalink
locking on ledger
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Michael Pfister <pfista@gmail.com>
  • Loading branch information
pfista committed Jun 17, 2016
1 parent 1c62cf7 commit db1f6f0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions exchange/bitswap/decision/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,9 @@ type LedgerSnapshot struct {
}

func (e *Engine) LedgerSnapshot(p peer.ID) *LedgerSnapshot {
e.lock.Lock()
defer e.lock.Unlock()

l := e.findOrCreate(p)
l.lk.Lock()
defer l.lk.Unlock()

snapshot := &LedgerSnapshot{
DebtRatio: l.Accounting.Value(),
Expand Down

0 comments on commit db1f6f0

Please sign in to comment.