From bec31179c24e6e4151e9657e49b4fb64575a8de0 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Thu, 22 Feb 2024 16:21:40 +0100 Subject: Proxy: Only call ready when client is not connected --- client/proxy.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'client') diff --git a/client/proxy.go b/client/proxy.go index 31a17a6..721dcac 100644 --- a/client/proxy.go +++ b/client/proxy.go @@ -28,7 +28,16 @@ func (c *Client) StartProxyguard(ck *cookie.Cookie, listen string, tcpsp int, pe var err error proxyguard.UpdateLogger(&ProxyLogger{}) proxyguard.GotClientFD = gotFD - proxyguard.ClientProxyReady = ready + proxyguard.ClientProxyReady = func() { + // already connected + // no need to signal to the client that the proxy is ready + if c.InState(StateConnected) { + log.Logger.Debugf("proxyguard is ready again when the client was already connected") + return + } + log.Logger.Debugf("forwarding proxyguard ready callback to client") + ready() + } u, err := url.Parse(peer) if err != nil { -- cgit v1.2.3