Skip to content

feat: implement peering service#7362

Merged
Stebalien merged 9 commits intomasterfrom
feat/peering
May 26, 2020
Merged

feat: implement peering service#7362
Stebalien merged 9 commits intomasterfrom
feat/peering

Conversation

@Stebalien
Copy link
Member

MVP for #6097

This feature will repeatedly reconnect (with a randomized exponential backoff) to peers in a set of "peered" peers.

In the future, this should be extended to:

  1. Include a CLI for modifying this list at runtime.
  2. Include additional options for peers we want to protect but not connect to.
  3. Allow configuring timeouts, backoff, etc.
  4. Allow groups? Possibly through textile threads.
  5. Allow for runtime-only peering rules.
  6. Different reconnect policies.

But this MVP should be a significant step forward.

@Stebalien
Copy link
Member Author

Depends on ipfs/go-ipfs-config#96

@Stebalien Stebalien requested a review from willscott May 26, 2020 00:07
@Stebalien Stebalien added this to the go-ipfs 0.6 milestone May 26, 2020

Default: `false`

### `Peering`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include expected behavior / semantics for how this behaves when one of the two peers has it, and when both have it mutually.

nextDelay time.Duration
}

func (ph *peerHandler) stop() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cancel ph.ctx ?

Copy link
Contributor

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me, I left a few comments/change requests but nothing super dramatic in case you want to just merge this and come back to it later.

Comment on lines +142 to +143
- [`Peering`](#peering)
- [`Peering.Peers`](#peeringpeers)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should any of this behavior going under the experimental label or no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured it was a minimal enough feature that that wasn't really necessary. I want people to start using this feature. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we can revisit this decision once the RC has shipped.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, I wasn't really sure what qualified as experimental vs not which is why I asked 😄

Stebalien and others added 5 commits May 25, 2020 20:24
MVP for #6097

This feature will repeatedly reconnect (with a randomized exponential backoff)
to peers in a set of "peered" peers.

In the future, this should be extended to:

1. Include a CLI for modifying this list at runtime.
2. Include additional options for peers we want to _protect_ but not connect to.
3. Allow configuring timeouts, backoff, etc.
4. Allow groups? Possibly through textile threads.
5. Allow for runtime-only peering rules.
6. Different reconnect policies.

But this MVP should be a significant step forward.
Co-authored-by: Will <will.scott@protocol.ai>
Co-authored-by: Adin Schmahmann <adin.schmahmann@gmail.com>
* better name for timer
* cancel context from within stop
* Explain _why_ it exists.
* Explain how it can be used.
@Stebalien Stebalien requested a review from aschmahmann May 26, 2020 04:29
@Stebalien Stebalien merged commit 1bf711d into master May 26, 2020
@Stebalien
Copy link
Member Author

@aschmahmann could you give this a once over post merge? I think it's good enough to go in the RC, but I'd like you to look at my changes.

@Stebalien Stebalien mentioned this pull request May 26, 2020
77 tasks
Copy link
Contributor

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Stebalien left a small comment on the go test, but LGTM

return h1.Network().Connectedness(h2.ID()) == network.Connected
}, 30*time.Second, 100*time.Millisecond)

require.Len(t, h1.Network().Peers(), 3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if it's worth doing anything about this, but noting that there's an unlikely race with the connmgr here where we prune in between connecting and doing the size check.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set the high water to 100 so that shouldn't happen.

@hacdias hacdias deleted the feat/peering branch May 9, 2023 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants