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.
|
||||
if !p.inbound {
|
||||
// TODO: Only do this if we're listening, not doing the initial
|
||||
// block download, and are routable.
|
||||
// Advertise the local address.
|
||||
na, err := newNetAddress(p.conn.LocalAddr(), p.services)
|
||||
if err != nil {
|
||||
log.Errorf("[PEER] %v", err)
|
||||
p.Disconnect()
|
||||
return
|
||||
// TODO(davec): Only do this if not doing the initial block
|
||||
// download and the local address is routable.
|
||||
if !cfg.DisableListen {
|
||||
// Advertise the local address.
|
||||
na, err := newNetAddress(p.conn.LocalAddr(), p.services)
|
||||
if err != nil {
|
||||
log.Errorf("[PEER] %v", err)
|
||||
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
|
||||
// more and the peer has a protocol version new enough to
|
||||
|
|
Loading…
Reference in a new issue