Skip to content

Commit

Permalink
Only update p.na on reciept of version message for inbound peers.
Browse files Browse the repository at this point in the history
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..
  • Loading branch information
Owain G. Ainsworth committed Nov 21, 2013
1 parent 694fcce commit 41d2d36
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 41d2d36

Please sign in to comment.