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

fix: limit use of custom context type #89

Merged
merged 1 commit into from
Mar 11, 2019
Merged

Conversation

Stebalien
Copy link
Member

Goprocess returns a custom context type. Unfortunately, golang has a bunch of magic type assertions to efficiently handle built-in context types but launches a new goroutine when deriving a new context from a custom context type. Otherwise, it has no way to wait on the custom context's channel.

This fix just ensures we only ever have one of goroutines per provide worker by deriving a (normal) cancelable context up-front and then using that.

Goprocess returns a _custom_ context type. Unfortunately, golang has a bunch of
magic type assertions to efficiently handle built-in context types but launches
a new goroutine when deriving a new context from a custom context type.
Otherwise, it has no way to wait on the custom context's channel.

This fix just ensures we only ever have one of goroutines per provide worker by
deriving a (normal) cancelable context up-front and then using that.
@ghost ghost assigned Stebalien Feb 28, 2019
@ghost ghost added the status/in-progress In progress label Feb 28, 2019
@Stebalien Stebalien merged commit 6acf56a into master Mar 11, 2019
@ghost ghost removed the status/in-progress In progress label Mar 11, 2019
Jorropo pushed a commit to Jorropo/go-libipfs that referenced this pull request Jan 26, 2023
fix: limit use of custom context type

This commit was moved from ipfs/go-bitswap@6acf56a
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.

1 participant