p2p/trust: lock on Copy()

This commit is contained in:
Ethan Buchman 2017-12-01 23:32:46 -05:00
parent 814541f6d9
commit cb9a1dbb4f
1 changed files with 2 additions and 0 deletions

View File

@ -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
}