From c5365160fbb4e6bd4a5959d94bdea052ec555f60 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Tue, 26 Mar 2019 16:41:30 -0700 Subject: [PATCH] server: wrap peer connection tiebreaking to 80 chars --- server.go | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/server.go b/server.go index 441c43cd..0ac45733 100644 --- a/server.go +++ b/server.go @@ -2156,14 +2156,17 @@ func (s *server) InboundPeerConnected(conn net.Conn) { case nil: // We already have a connection with the incoming peer. If the - // connection we've already established should be kept and is not of - // the same type of the new connection (inbound), then we'll close out - // the new connection s.t there's only a single connection between us. + // connection we've already established should be kept and is + // not of the same type of the new connection (inbound), then + // we'll close out the new connection s.t there's only a single + // connection between us. localPub := s.identityPriv.PubKey() - if !connectedPeer.inbound && !shouldDropLocalConnection(localPub, nodePub) { - srvrLog.Warnf("Received inbound connection from peer %v, "+ - "but already have outbound connection, dropping conn", - connectedPeer) + if !connectedPeer.inbound && + !shouldDropLocalConnection(localPub, nodePub) { + + srvrLog.Warnf("Received inbound connection from "+ + "peer %v, but already have outbound "+ + "connection, dropping conn", connectedPeer) conn.Close() return } @@ -2264,14 +2267,17 @@ func (s *server) OutboundPeerConnected(connReq *connmgr.ConnReq, conn net.Conn) case nil: // We already have a connection with the incoming peer. If the - // connection we've already established should be kept and is not of - // the same type of the new connection (outbound), then we'll close out - // the new connection s.t there's only a single connection between us. + // connection we've already established should be kept and is + // not of the same type of the new connection (outbound), then + // we'll close out the new connection s.t there's only a single + // connection between us. localPub := s.identityPriv.PubKey() - if connectedPeer.inbound && shouldDropLocalConnection(localPub, nodePub) { - srvrLog.Warnf("Established outbound connection to peer %v, "+ - "but already have inbound connection, dropping conn", - connectedPeer) + if connectedPeer.inbound && + shouldDropLocalConnection(localPub, nodePub) { + + srvrLog.Warnf("Established outbound connection to "+ + "peer %v, but already have inbound "+ + "connection, dropping conn", connectedPeer) if connReq != nil { s.connMgr.Remove(connReq.ID()) }