-
Notifications
You must be signed in to change notification settings - Fork 57
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
dkim: Always close done channel in Sign #15
Conversation
Codecov Report
@@ Coverage Diff @@
## master #15 +/- ##
=======================================
Coverage 66.46% 66.46%
=======================================
Files 7 7
Lines 832 832
=======================================
Hits 553 553
Misses 210 210
Partials 69 69
Continue to review full report at Codecov.
|
Not sure why this is necessary. |
The problem is in Line 318 in af51aa1
and then also in defer :Line 308 in af51aa1
Second Close reads from done and blocks forever. close(done) fixes it by closing channel so it will return null value without blocking after first read. This makes Close function idempotent (it is safe to call it multiple times), which is also a convenient thing to have.
|
Sure, but I don't get why |
Because it doesn't have to? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. I guess it doesn't matter to return an error in our Close
function, because our Write
function would have returned an error before.
Thanks! |
Added
defer close(done)
as proposed in the linked issue.Closes #8.