mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-01 04:34:21 -04:00
reverse_proxy: Close idle connections on module unload
This commit is contained in:
parent
f15f0d5839
commit
db4c73dd58
@ -123,6 +123,14 @@ func (h HTTPTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
return h.RoundTripper.RoundTrip(req)
|
return h.RoundTripper.RoundTrip(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cleanup implements caddy.CleanerUpper and closes any idle connections.
|
||||||
|
func (h HTTPTransport) Cleanup() error {
|
||||||
|
if ht, ok := h.RoundTripper.(*http.Transport); ok {
|
||||||
|
ht.CloseIdleConnections()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// TLSConfig holds configuration related to the
|
// TLSConfig holds configuration related to the
|
||||||
// TLS configuration for the transport/client.
|
// TLS configuration for the transport/client.
|
||||||
type TLSConfig struct {
|
type TLSConfig struct {
|
||||||
@ -205,4 +213,5 @@ type KeepAlive struct {
|
|||||||
var (
|
var (
|
||||||
_ caddy.Provisioner = (*HTTPTransport)(nil)
|
_ caddy.Provisioner = (*HTTPTransport)(nil)
|
||||||
_ http.RoundTripper = (*HTTPTransport)(nil)
|
_ http.RoundTripper = (*HTTPTransport)(nil)
|
||||||
|
_ caddy.CleanerUpper = (*HTTPTransport)(nil)
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user