mirror of
https://github.com/lightninglabs/aperture.git
synced 2026-02-22 01:44:28 +01:00
multi: cleanup proxy
This commit adds to ability to cleanup the Proxy by adding a Close method and calling this method during server shut down.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user