Skip to content

Commit

Permalink
lock peer fields
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Nov 5, 2014
1 parent 672c7b1 commit d04da7c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions peer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,14 @@ func (p *peer) Update(other Peer) error {
}

func (p *peer) GetVersions() (agent, protocol string) {
p.RLock()
defer p.RUnlock()
return p.agentVersion, p.protocolVersion
}

func (p *peer) SetVersions(agent, protocol string) {
p.Lock()
defer p.Unlock()
p.agentVersion = agent
p.protocolVersion = protocol
}
Expand Down

0 comments on commit d04da7c

Please sign in to comment.