From 997e6ed2b982e6455348bb82a2725de91f28093e Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Fri, 14 Nov 2014 14:28:45 +0000 Subject: [PATCH] squash two ifs together --- router/connection.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/router/connection.go b/router/connection.go index 64b4ee04..72efc333 100644 --- a/router/connection.go +++ b/router/connection.go @@ -345,10 +345,8 @@ func (conn *LocalConnection) handshake(acceptNewPeer bool) error { return fmt.Errorf("Found unknown remote name: %s at %s", name, conn.remoteTCPAddr) } } - if existingConn, found := conn.local.ConnectionTo(name); found { - if existingConn.Established() { - return fmt.Errorf("Already have connection to %s at %s", name, existingConn.RemoteTCPAddr()) - } + if existingConn, found := conn.local.ConnectionTo(name); found && existingConn.Established() { + return fmt.Errorf("Already have connection to %s at %s", name, existingConn.RemoteTCPAddr()) } uidStr, err := checkHandshakeStringField("UID", "", handshakeRecv)