p2p/trust: lock on Copy()
This commit is contained in:
parent
814541f6d9
commit
cb9a1dbb4f
|
@ -234,6 +234,8 @@ func (tm *TrustMetric) NextTimeInterval() {
|
|||
|
||||
// Copy returns a new trust metric with members containing the same values
|
||||
func (tm *TrustMetric) Copy() *TrustMetric {
|
||||
tm.mtx.Lock()
|
||||
defer tm.mtx.Unlock()
|
||||
if tm == nil {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue