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

don't hold the lock when closing #7

Merged
merged 4 commits into from
Dec 11, 2017
Merged

don't hold the lock when closing #7

merged 4 commits into from
Dec 11, 2017

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Dec 11, 2017

In libp2p, Close is assumed to be threadsafe and we'd like to interrupt in-progress reads/writes.

As a matter of fact, we're lucky this hasn't caused close to hang permanently (it still hangs occasionally, just for a bounded amount of time). If we had tried to close the reader before closing the writer, we would have blocked on a concurrent read call.

fixes #8

In libp2p, Close is assumed to be threadsafe and we'd like to interrupt
in-progress reads/writes.

As a matter of fact, we're lucky this hasn't caused close to hang. If we had
tried to close the reader before closing the writer, we would have blocked on a
concurrent read call.

Part of ipfs/kubo#2823
@whyrusleeping
Copy link
Contributor

merge when ready

@Stebalien Stebalien merged commit d82125c into master Dec 11, 2017
@Stebalien Stebalien deleted the feat/fast-close branch December 11, 2017 22:05
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.

Don't hold lock while closing
2 participants