Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

util: waitUntilConnected #310

Closed
Closed
@travisperson

Description

@travisperson

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).

https://github.com/ipfs/interface-ipfs-core/blob/f238e9f0ba8132dba51d3bac1eb491701f505ccd/js/src/ping.js#L38-L52

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?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions