]> dgit.raspbian.org Git - git-annex.git/commitdiff
avoid loop between cluster gateways
authorJoey Hess <joeyh@joeyh.name>
Wed, 26 Jun 2024 19:27:16 +0000 (15:27 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 26 Jun 2024 19:29:59 +0000 (15:29 -0400)
The VIA extension is still needed to avoid some extra work and ugly
messages, but this is enough that it actually works.

This filters out the RemoteSides that are a proxied connection via a
remote gateway to the cluster.

The VIA extension will not filter those out, but will send VIA to them
on connect, which will cause the ones that are accessed via the listed
gateways to be filtered out.

Annex/Cluster.hs
doc/todo/git-annex_proxies.mdwn

index 6ddf9029c1afda9faaea0542e6a195aa8e50f978..8438881829104fe349a369159256489b0e2d046e 100644 (file)
@@ -96,8 +96,8 @@ clusterProxySelector clusteruuid protocolversion = do
   where
        -- Nodes of the cluster have remote.name.annex-cluster-node
        -- containing its name. Or they are proxied by a remote
-       -- that has remote.name.annex-cluster-node containing the cluster's
-       -- UUID.
+       -- that has remote.name.annex-cluster-gateway
+       -- containing the cluster's UUID.
        isnode rs nodeuuids clusternames r = 
                case remoteAnnexClusterNode (Remote.gitconfig r) of
                        Just names
@@ -106,11 +106,13 @@ clusterProxySelector clusteruuid protocolversion = do
                                                ClusterNodeUUID $ Remote.uuid r
                                | otherwise -> False
                        Nothing -> case remoteAnnexProxiedBy (Remote.gitconfig r) of
-                               Just proxyuuid -> not $ null $
-                                       filter (== clusteruuid) $
-                                       concatMap (remoteAnnexClusterGateway . Remote.gitconfig) $
-                                       filter (\p -> Remote.uuid p == proxyuuid) rs
-                               Nothing -> False
+                               Just proxyuuid
+                                       | Remote.uuid r /= fromClusterUUID clusteruuid -> 
+                                               not $ null $
+                                                       filter (== clusteruuid) $
+                                                       concatMap (remoteAnnexClusterGateway . Remote.gitconfig) $
+                                                       filter (\p -> Remote.uuid p == proxyuuid) rs
+                               _ -> False
        
        isclustername clusternames name = 
                M.lookup name clusternames == Just clusteruuid
index ac106adceb5378d87661b42e3b73bacbbf6459c7..206991c731e823f8fcd397bd227366c32eb7e819 100644 (file)
@@ -33,6 +33,9 @@ For June's work on [[design/passthrough_proxy]], remaining todos:
   protocol messages on to any remotes that have the same UUID as
   the cluster. Needs VIA extension to P2P protocol to avoid cycles.
 
+  Status: works, but needs VIA extension to avoid ugly messages and extra
+  work
+
 * Getting a key from a cluster currently always selects the lowest cost
   remote, and always the same remote if cost is the same. Should
   round-robin amoung remotes, and prefer to avoid using remotes that