-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically connect to replicated peers #339
Conversation
Problem: By default we only connect to people that we're directly following, which often don't have public IP addresses. Solution: Automatically connect to all available peers within our replication hops (default 2) to make peering more reliable.
How does this behave for you? For me, ssb.conn.stagedPeers() seems to give the same three peers over and over again (none of which happen to be within hop range for me).
|
lodash.get(ssbConfig, "friends.hops", 0) | ||
); | ||
|
||
const add = address => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks to me like ssb-conn's (ssb-conn-hub's) connect function already handles this (connect() returns false if there's already a connection open or in progress), so inProgress
and add
probably aren't necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! I noticed that the same person was showing up multiple times in my peer list, but maybe one was just { state: 'connecting' }
.
Here's what I'm seeing:
I think the right way to do this would be to make the hops configurable in SSB-CONN, but I'm not sure if that's an option (see ssbc/ssb-conn#16). |
I read ssb-conn's readme; staging contains peers with autoconnect=false, and these three peers were the only ones with autoconnect=false in my conn.json, for whatever reason. After moving conn.json (and gossip.json for good measure), everything in conn.json is autoconnect=false, so this makes more sense now. Bluetooth peers are also in staging, so a possible side effect is that we'd hypothetically aggressively connect to bt peers, but that seems fine (?). |
Problem: By default we only connect to people that we're directly
following, which often don't have public IP addresses.
Solution: Automatically connect to all available peers within our
replication hops (default 2) to make peering more reliable.