From 57706fd9442bf9223886d7faef7c45ddb1fb9247 Mon Sep 17 00:00:00 2001 From: hc-github-team-consul-core <82989933+hc-github-team-consul-core@users.noreply.github.com> Date: Fri, 27 May 2022 16:52:40 -0400 Subject: [PATCH] backport of commit 07215e8065dd233f92b3955b895e64efae51f341 (#13287) This pull request was automerged via backport-assistant --- connect/proxy/proxy.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/connect/proxy/proxy.go b/connect/proxy/proxy.go index f77d96ca931b..fcce3115602e 100644 --- a/connect/proxy/proxy.go +++ b/connect/proxy/proxy.go @@ -123,6 +123,9 @@ func (p *Proxy) Serve() error { cfg = newCfg case <-p.stopChan: + if p.service != nil { + p.service.Close() + } return nil } } @@ -153,7 +156,4 @@ func (p *Proxy) startListener(name string, l *Listener) error { // called only once. func (p *Proxy) Close() { close(p.stopChan) - if p.service != nil { - p.service.Close() - } }