-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
add TLS support to HalfCloser interface #6216
Conversation
a17b2de
to
38bd383
Compare
Yeah I think the old model was fine and we should just return the half closer for tls too. This PR is actually not bad and might even be closer to what I'd have written in the first place but I think it would be a smaller change to keep HalfCloser and make it work for TLS instead. The (tiny, theoretical) benefit of the interface is that if we ever have other conn types (unlikey) we wouldn't have to change this code to make it work... |
Directly calls net.TCPConn.CloseWrite or mtls.Conn.CloseWrite, which was added in https://go-review.googlesource.com/c/go/+/31318/
38bd383
to
890bec0
Compare
890bec0
to
3f55083
Compare
This should be ready for review again - any suggestions on if/how/where I should write a test for this? |
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.
Nice! Seems like a simpler change.
I can't think of a good way to test this sadly without either changing the code much more to plumb in dummy diallers or some elaborate, flaky integration test and I don't think either is a good use of time.
Co-Authored-By: Paul Banks <banks@banksco.de>
This relates to a known issue documented in #6203, and may fix TLS connections to half-close properly.
When I started writing this I had assumed
CloseWrite
would exist on the returnednet.Conn
object and wouldn't need to cast inagent/consul/snapshot_endpoint.go
, looking back may want to re-implementHalfCloser
, just over either connection type now?https://github.com/hashicorp/consul/blob/02a52ef22881bcf98184a9604294aacfaf846c09/agent/consul/snapshot_endpoint.go#L225-L244
Refs golang/go#8579