fix: use RLock
This commit is contained in:
parent
2bb558f878
commit
1ecbda1a54
|
@ -130,13 +130,13 @@ func (p *WebSocketPeer) EndForAbuse() error {
|
|||
return nil
|
||||
}
|
||||
func (p *WebSocketPeer) SetId(id *encoding.NodeId) {
|
||||
p.BasePeer.lock.Lock()
|
||||
p.BasePeer.lock.RLock()
|
||||
defer p.BasePeer.lock.Unlock()
|
||||
p.id = id
|
||||
}
|
||||
|
||||
func (p *WebSocketPeer) SetChallenge(challenge []byte) {
|
||||
p.BasePeer.lock.Lock()
|
||||
p.BasePeer.lock.RLock()
|
||||
defer p.BasePeer.lock.Unlock()
|
||||
p.challenge = challenge
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ func (p *WebSocketPeer) GetChallenge() []byte {
|
|||
}
|
||||
|
||||
func (p *WebSocketPeer) GetIP() net.Addr {
|
||||
p.BasePeer.lock.Lock()
|
||||
p.BasePeer.lock.RLock()
|
||||
defer p.BasePeer.lock.Unlock()
|
||||
if p.ip != nil {
|
||||
return p.ip
|
||||
|
@ -173,7 +173,7 @@ func (b *WebSocketPeer) GetIPString() string {
|
|||
}
|
||||
|
||||
func (p *WebSocketPeer) Abuser() bool {
|
||||
p.BasePeer.lock.Lock()
|
||||
p.BasePeer.lock.RLock()
|
||||
defer p.BasePeer.lock.Unlock()
|
||||
return p.abuser
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue