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

When a stream is closed, cancel pending writes #35

Merged
merged 1 commit into from
Dec 16, 2018

Conversation

Ichbinjoe
Copy link
Contributor

Should be relatively straight forward. #9

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

Thanks!

How about storing a context and a cancel function in the stream itself? write can then just pass this context through (attaching the deadline if necessary) and we can avoid the double close issue (it's safe to call cancel twice) and the additional goroutine.

stream.go Outdated Show resolved Hide resolved
@Ichbinjoe
Copy link
Contributor Author

I'm not sure why I had chosen this method over just storing the context, but considering I can't think of the reason a day later, it must not have been a very good reason.

@Stebalien
Copy link
Member

LGTM but someone from the libp2p team should really get the final signoff. @bigs?

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.

LGTM

@Stebalien Stebalien merged commit a678489 into libp2p:master Dec 16, 2018
@Stebalien
Copy link
Member

Thanks @vyzo!

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.

3 participants