Skip to content
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

move the go-libp2p-connmgr here #1297

Merged
merged 80 commits into from
Jan 18, 2022
Merged

move the go-libp2p-connmgr here #1297

merged 80 commits into from
Jan 18, 2022

Conversation

marten-seemann
Copy link
Contributor

This is easy, as go-libp2p doesn't yet depend on this package yet.
We will initialize a default connection manager in an upcoming PR very soon though.

whyrusleeping and others added 30 commits July 8, 2017 09:44
1. Don't ask the system for the time when checking if we should close each
connection (potentially thousands of systemcalls!).
2. Log from outside the lock.
3. Log the event around the entire connection closing operation.
4. Preallocate the slice holding the connections to be closed.
faster, cleaner connection closing
Add docs to BasicConnMgr
Fix concurrency and silence period not being honoured
Users can call Protect() to save a peer from pruning, and Unprotect() to
remove the protection. Protected peers don't count towards the target
quantity to prune during a connection manager cycle.
Also slightly reworked the loop that selects candidates to prune to make
it better behaved. Before, if we needed to prune N connections, we
preselected N and ended up doing nothing if they happened to be in the
grace period. Now we skip over them and prune ungraced connections until
we meet our target.
Add peer protection capability (implementation)
- fix potential concurrent modification of connection map
  from concurrent connects/disconnects by locking the segment
- don't spawn goroutines on every connect during trims
marten-seemann and others added 25 commits November 26, 2021 10:50
fix race condition in getConnsToClose
add an error return value to the constructor
As trims are triggered by a time.Ticker, this would lead to roughly every
second trim being skipped. It also makes calling TrimOpenConns pointless.
remove check for the last trim time when trimming
introduce WithGracePeriod and WithSilencePeriod configuration options
fix flaky tests caused by super short silence periods
aggressively trim connections when we're running out of memory
make emergency trimming optional, disabled by default
@marten-seemann marten-seemann mentioned this pull request Jan 17, 2022
69 tasks
Copy link
Contributor

@vyzo vyzo left a comment

Choose a reason for hiding this comment

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

do it!

@@ -46,6 +47,7 @@ require (
github.com/multiformats/go-varint v0.0.6
github.com/prometheus/common v0.30.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/raulk/go-watchdog v1.2.0
Copy link
Contributor

Choose a reason for hiding this comment

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

that a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's hidden behind the cgo flag (libp2p/go-libp2p-connmgr#103).

@marten-seemann marten-seemann merged commit 05fe672 into master Jan 18, 2022
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.

6 participants