Add check during initial handshake whether we already have an established connection to this peer

This commit is contained in:
Bryan Boreham committed 2014-11-14 14:02:33 +00:00
1 parent f9f29bbe42
commit 57aecb868f
1 file changed
+5
+5
View File
@@ -345,6 +345,11 @@ 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())
}
}
uidStr, err := checkHandshakeStringField("UID", "", handshakeRecv)
if err != nil {