peer: disconnected peer - return non-nil LocalAddr
This commit is contained in:
parent
b134beb3b7
commit
7f237aa5e5
1 changed files with 1 additions and 1 deletions
|
@ -686,7 +686,7 @@ func (p *Peer) LastRecv() time.Time {
|
|||
// This function is safe fo concurrent access.
|
||||
func (p *Peer) LocalAddr() net.Addr {
|
||||
var localAddr net.Addr
|
||||
if p.Connected() {
|
||||
if atomic.LoadInt32(&p.connected) != 0 {
|
||||
localAddr = p.conn.LocalAddr()
|
||||
}
|
||||
return localAddr
|
||||
|
|
Loading…
Add table
Reference in a new issue