Only advertise local addr to peers when listenting.
Do not advertise the local address to outbound peers when we aren't listening and therefore able to accept connections.
This commit is contained in:
parent
627959adff
commit
6acd51f4b4
1 changed files with 14 additions and 12 deletions
26
peer.go
26
peer.go
|
@ -204,19 +204,21 @@ func (p *peer) handleVersionMsg(msg *btcwire.MsgVersion) {
|
||||||
|
|
||||||
// Outbound connections.
|
// Outbound connections.
|
||||||
if !p.inbound {
|
if !p.inbound {
|
||||||
// TODO: Only do this if we're listening, not doing the initial
|
// TODO(davec): Only do this if not doing the initial block
|
||||||
// block download, and are routable.
|
// download and the local address is routable.
|
||||||
// Advertise the local address.
|
if !cfg.DisableListen {
|
||||||
na, err := newNetAddress(p.conn.LocalAddr(), p.services)
|
// Advertise the local address.
|
||||||
if err != nil {
|
na, err := newNetAddress(p.conn.LocalAddr(), p.services)
|
||||||
log.Errorf("[PEER] %v", err)
|
if err != nil {
|
||||||
p.Disconnect()
|
log.Errorf("[PEER] %v", err)
|
||||||
return
|
p.Disconnect()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
addresses := map[string]*btcwire.NetAddress{
|
||||||
|
NetAddressKey(na): na,
|
||||||
|
}
|
||||||
|
p.pushAddrMsg(addresses)
|
||||||
}
|
}
|
||||||
addresses := map[string]*btcwire.NetAddress{
|
|
||||||
NetAddressKey(na): na,
|
|
||||||
}
|
|
||||||
p.pushAddrMsg(addresses)
|
|
||||||
|
|
||||||
// Request known addresses if the server address manager needs
|
// Request known addresses if the server address manager needs
|
||||||
// more and the peer has a protocol version new enough to
|
// more and the peer has a protocol version new enough to
|
||||||
|
|
Loading…
Reference in a new issue