server: wrap peer connection tiebreaking to 80 chars
This commit is contained in:
parent
7358535725
commit
c5365160fb
34
server.go
34
server.go
@ -2156,14 +2156,17 @@ func (s *server) InboundPeerConnected(conn net.Conn) {
|
|||||||
|
|
||||||
case nil:
|
case nil:
|
||||||
// We already have a connection with the incoming peer. If the
|
// We already have a connection with the incoming peer. If the
|
||||||
// connection we've already established should be kept and is not of
|
// connection we've already established should be kept and is
|
||||||
// the same type of the new connection (inbound), then we'll close out
|
// not of the same type of the new connection (inbound), then
|
||||||
// the new connection s.t there's only a single connection between us.
|
// we'll close out the new connection s.t there's only a single
|
||||||
|
// connection between us.
|
||||||
localPub := s.identityPriv.PubKey()
|
localPub := s.identityPriv.PubKey()
|
||||||
if !connectedPeer.inbound && !shouldDropLocalConnection(localPub, nodePub) {
|
if !connectedPeer.inbound &&
|
||||||
srvrLog.Warnf("Received inbound connection from peer %v, "+
|
!shouldDropLocalConnection(localPub, nodePub) {
|
||||||
"but already have outbound connection, dropping conn",
|
|
||||||
connectedPeer)
|
srvrLog.Warnf("Received inbound connection from "+
|
||||||
|
"peer %v, but already have outbound "+
|
||||||
|
"connection, dropping conn", connectedPeer)
|
||||||
conn.Close()
|
conn.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2264,14 +2267,17 @@ func (s *server) OutboundPeerConnected(connReq *connmgr.ConnReq, conn net.Conn)
|
|||||||
|
|
||||||
case nil:
|
case nil:
|
||||||
// We already have a connection with the incoming peer. If the
|
// We already have a connection with the incoming peer. If the
|
||||||
// connection we've already established should be kept and is not of
|
// connection we've already established should be kept and is
|
||||||
// the same type of the new connection (outbound), then we'll close out
|
// not of the same type of the new connection (outbound), then
|
||||||
// the new connection s.t there's only a single connection between us.
|
// we'll close out the new connection s.t there's only a single
|
||||||
|
// connection between us.
|
||||||
localPub := s.identityPriv.PubKey()
|
localPub := s.identityPriv.PubKey()
|
||||||
if connectedPeer.inbound && shouldDropLocalConnection(localPub, nodePub) {
|
if connectedPeer.inbound &&
|
||||||
srvrLog.Warnf("Established outbound connection to peer %v, "+
|
shouldDropLocalConnection(localPub, nodePub) {
|
||||||
"but already have inbound connection, dropping conn",
|
|
||||||
connectedPeer)
|
srvrLog.Warnf("Established outbound connection to "+
|
||||||
|
"peer %v, but already have inbound "+
|
||||||
|
"connection, dropping conn", connectedPeer)
|
||||||
if connReq != nil {
|
if connReq != nil {
|
||||||
s.connMgr.Remove(connReq.ID())
|
s.connMgr.Remove(connReq.ID())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user