diff --git a/aperture.go b/aperture.go index 05d2b85..8434d9a 100644 --- a/aperture.go +++ b/aperture.go @@ -276,7 +276,7 @@ func (a *Aperture) Stop() error { // Shut down our client and server connections now. This should cause // the first goroutine to quit. - cleanup(a.etcdClient, a.httpsServer) + cleanup(a.etcdClient, a.httpsServer, a.proxy) // If we started a tor server as well, shut it down now too to cause the // second goroutine to quit. @@ -514,7 +514,10 @@ func createProxy(cfg *Config, challenger *LndChallenger, } // cleanup closes the given server and shuts down the log rotator. -func cleanup(etcdClient io.Closer, server io.Closer) { +func cleanup(etcdClient io.Closer, server io.Closer, proxy io.Closer) { + if err := proxy.Close(); err != nil { + log.Errorf("Error terminating proxy: %v", err) + } if err := etcdClient.Close(); err != nil { log.Errorf("Error terminating etcd client: %v", err) } diff --git a/proxy/proxy.go b/proxy/proxy.go index f0ba134..6efd772 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -186,6 +186,11 @@ func (p *Proxy) UpdateServices(services []*Service) error { return nil } +// Close cleans up the Proxy by closing any remaining open connections. +func (p *Proxy) Close() error { + return nil +} + // director is a method that rewrites an incoming request to be forwarded to a // backend service. func (p *Proxy) director(req *http.Request) {