feat(netxlite): TLSDialer closes idle connections (#463)

We are proceeding with this plan of every major type being able to
close idle connections, which will simplify making DNS resolvers.

See https://github.com/ooni/probe/issues/1591.
This commit is contained in:
Simone Basso 2021-09-06 13:29:37 +02:00 committed by GitHub
commit ef9592f75e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 4 deletions

View file

@ -228,6 +228,11 @@ type TLSDialer struct {
TLSHandshaker TLSHandshaker
}
// CloseIdleConnection closes idle connections, if any.
func (d *TLSDialer) CloseIdleConnection() {
d.Dialer.CloseIdleConnections()
}
// DialTLSContext dials a TLS connection.
func (d *TLSDialer) DialTLSContext(ctx context.Context, network, address string) (net.Conn, error) {
host, port, err := net.SplitHostPort(address)