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

Protect Libp2p Connections #229

Merged
merged 4 commits into from
Sep 29, 2021
Merged

Protect Libp2p Connections #229

merged 4 commits into from
Sep 29, 2021

Conversation

hannahhoward
Copy link
Collaborator

@hannahhoward hannahhoward commented Sep 29, 2021

Goals

Protect libp2p connections in go-graphsync. fix #226

Implementation

  • Add ConnManager to network interface
  • In both RequestManager and ResponseManager, protect the connection at the time the request is queued, and release the connection when the request terminates
  • Protect by RequestID so that protections are unique to request
  • Modify ResponseManager to use state pattern from RequestManager -- this corrects a bug discovered in failure to cleanup request when cancelled before it starts executing.

graphsync.go Outdated
@@ -14,6 +15,10 @@ import (
// RequestID is a unique identifier for a GraphSync request.
type RequestID int32

func (r RequestID) String() string {
return strconv.Itoa(int(r))
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this preferable to fmt.Sprintf("%d", r)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

should we have a namespace prefix to prevent potential tag collisions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yea I like that.

make tag for request IDs unique to graphsync
@hannahhoward hannahhoward merged commit ce3951d into main Sep 29, 2021
@aschmahmann aschmahmann mentioned this pull request Dec 1, 2021
80 tasks
@mvdan mvdan deleted the feat/hold-connections branch December 15, 2021 14:18
marten-seemann pushed a commit that referenced this pull request Mar 2, 2023
* refactor: simplify graphsync cancel

* docs: add lock required comments to graphsync transport

* feat: restore wait for complete in graphsync transport

* feat: upgrade to graphsync v0.6.8
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.

Protect Connections
2 participants