squash two ifs together

This commit is contained in:
Bryan Boreham committed 2014-11-14 14:28:45 +00:00
1 parent 57aecb868f
commit 997e6ed2b9
1 file changed
+2 -4
+2 -4
View File
@@ -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)