Only update p.na on reciept of version message for inbound peers.

Outbound we already have the exact same thing set up, and this should
quieten the race detector. Please note that this does *not* cause
problems with the service flags being wrong. Since by this point we have
already done every thing that would use the service flags from p.na in
addrmanager, and now p.Services is correct..
This commit is contained in:
Owain G. Ainsworth 2013-11-21 19:05:14 +00:00
parent 694fccefa8
commit 41d2d36643

18
peer.go
View file

@ -261,16 +261,18 @@ func (p *peer) handleVersionMsg(msg *btcwire.MsgVersion) {
p.Disconnect()
return
}
}
// Set up a NetAddress for the peer to be used with AddrManager.
na, err := newNetAddress(p.conn.RemoteAddr(), p.services)
if err != nil {
p.logError("PEER: Can't get remote address: %v", err)
p.Disconnect()
return
// Set up a NetAddress for the peer to be used with AddrManager.
// We only do this inbound because outbound set this up
// at connection time and no point recomputing.
na, err := newNetAddress(p.conn.RemoteAddr(), p.services)
if err != nil {
p.logError("PEER: Can't get remote address: %v", err)
p.Disconnect()
return
}
p.na = na
}
p.na = na
// Send verack.
p.QueueMessage(btcwire.NewMsgVerAck(), nil)