mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-25 18:51:39 +00:00
Add RemoteAddr and ListenAddr to NodeInfo; Refactor IPRange logic
This commit is contained in:
10
switch.go
10
switch.go
@ -224,10 +224,6 @@ func (sw *Switch) AddPeerWithConnection(conn net.Conn, outbound bool) (*Peer, er
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// The peerNodeInfo is not verified, so overwrite
|
||||
// the IP, and the port too if we dialed out
|
||||
// Everything else we just have to trust
|
||||
peerNodeInfo.Address = sconn.RemoteAddr().String()
|
||||
peer := newPeer(sconn, peerNodeInfo, outbound, sw.reactorsByCh, sw.chDescs, sw.StopPeerForError)
|
||||
|
||||
// Add the peer to .peers
|
||||
@ -351,12 +347,6 @@ func (sw *Switch) listenerRoutine(l Listener) {
|
||||
continue
|
||||
}
|
||||
|
||||
// Ignore connections from IP ranges for which we have too many
|
||||
if sw.peers.HasMaxForIPRange(inConn) {
|
||||
log.Info("Ignoring inbound connection: already have enough peers for that IP range", "address", inConn.RemoteAddr().String())
|
||||
continue
|
||||
}
|
||||
|
||||
// New inbound connection!
|
||||
_, err := sw.AddPeerWithConnection(inConn, false)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user