You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 9, 2022. It is now read-only.
It's possible to cause a dial cycle in the relay (libp2p/go-libp2p#816). While it would be nice to be able to solve this in the general case, we can at least solve this in this transport by keeping track of dial dependencies.
We need to keep a directed graph of active dials mapping target nodes (the ones we're dialing) to relays (the relays we're dialing those nodes through). Then, before we dial a target node, we can lookup the chosen relay in this graph, to see if it is also a target node. If it is, we need to recursively follow the graph to see if we end back up at the original target. If we do, we have a cycle and we need to abort.
More concretely, if we first try to dial b through c, then a through b, we'd have the following edges in our graph:
a (target) -> b (relay)
b (target) -> c (relay)
Then, if we try to dial c through a, we'd:
Lookup a in the graph, and get b,
Lookup b in the graph, and get c.
Compare c == c, determine that we have a cycle, and abort.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It's possible to cause a dial cycle in the relay (libp2p/go-libp2p#816). While it would be nice to be able to solve this in the general case, we can at least solve this in this transport by keeping track of dial dependencies.
We need to keep a directed graph of active dials mapping target nodes (the ones we're dialing) to relays (the relays we're dialing those nodes through). Then, before we dial a target node, we can lookup the chosen relay in this graph, to see if it is also a target node. If it is, we need to recursively follow the graph to see if we end back up at the original target. If we do, we have a cycle and we need to abort.
More concretely, if we first try to dial b through c, then a through b, we'd have the following edges in our graph:
Then, if we try to dial c through a, we'd:
The text was updated successfully, but these errors were encountered: