Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

fix: send cancel when GetBlocks() is cancelled #383

Merged
merged 5 commits into from
May 1, 2020

Conversation

dirkmc
Copy link
Contributor

@dirkmc dirkmc commented Apr 27, 2020

Fixes #253
Fixes ipfs/boxo#124

Depends on #377

@dirkmc dirkmc requested a review from Stebalien April 27, 2020 19:17
internal/sessionwantlist/sessionwantlist.go Outdated Show resolved Hide resolved
@@ -130,3 +155,23 @@ func (sm *SessionManager) ReceiveFrom(ctx context.Context, p peer.ID, blks []cid
// Send CANCEL to all peers with want-have / want-block
sm.peerManager.SendCancels(ctx, blks)
Copy link
Member

Choose a reason for hiding this comment

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

Really, why do we use these contexts anywhere? We should probably just keep using the session context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I don't follow..

Copy link
Member

Choose a reason for hiding this comment

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

This was in response to a comment/PR you made about using the global context for canceling, instead of the session context. My point is that we should probably just remove contexts from most of these method signatures.

As a matter of fact, this context is going to be the one we get from ReceiveFrom, which is going to be the context we get from ReceiveMessage, which is going to be the background context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I open an issue to discuss?

internal/sessionmanager/sessionmanager.go Show resolved Hide resolved
internal/session/sessionwantsender.go Show resolved Hide resolved
internal/session/sessionwantsender.go Outdated Show resolved Hide resolved
* refactor: customize SessionInterestManager

* refactor: SessionInterestManager perf
@dirkmc dirkmc merged commit 7d58b2a into refactor/sess-mgr-shutdown May 1, 2020
@dirkmc dirkmc deleted the fix/ctx-cancels branch May 1, 2020 15:08
dirkmc added a commit that referenced this pull request May 1, 2020
* fix: use one less go-routine per session

* fix: send cancel when GetBlocks() is cancelled (#383)

* fix: send cancel when GetBlocks() is cancelled

* fix: in SessionManager shutdown nil out sessions

* fix: sessionWantSender perf

* make sessionWantSender.SignalAvailability() non-blocking

* Refactor SessionInterestManager (#384)

* refactor: customize SessionInterestManager

* refactor: SessionInterestManager perf
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants