util: waitUntilConnected #310
Description
I've been going through the code and identifying patterns or ways to help clean up the code to make things easier to read and understand.
(Note: I've been working off of the in-progress PR #290)
There are a few tests that require multiple nodes to be connected (ping, pubsub, dht).
Running through this I found this setup code for ping
, which uses a method waitUntilConnected
, which doesn't actually connect any nodes, but instead just waits around till the nodes find each other (as far as I can tell).
It appears that it heavily relies on peer discovery, which is dependent on how the node is configured, particularity for js-ipfs-core.
@alanshaw I believe you wrote this code. I believe it was added so that the tests itself did not have to attempt to find and connect to the peers, and instead could rely on the peers already being connected before conducting the pings.
Any reasons to use waitUntilConnected
over simply calling ipfs.swarm.connect
?