diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-07-10 14:37:14 +0200 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2024-07-17 14:00:03 +0000 |
| commit | 7f8af5845ddec1816f93a2cb013f0818c19caab3 (patch) | |
| tree | 66f3cfbac66d5cfbb144bca78e926b58a80ad624 | |
| parent | 8c01291b23cb2fb11d4e4794b6f7369b13d3c840 (diff) | |
Client Proxy: Fix theoretical race condition
| -rw-r--r-- | client/proxy.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/client/proxy.go b/client/proxy.go index b39af32..ed17c82 100644 --- a/client/proxy.go +++ b/client/proxy.go @@ -80,6 +80,7 @@ func (p *Proxy) Tunnel(ctx context.Context, peer string) error { } cctx, cf := context.WithCancel(ctx) p.cancel = cf + client := *p.c p.mu.Unlock() defer func() { p.mu.Lock() @@ -87,7 +88,7 @@ func (p *Proxy) Tunnel(ctx context.Context, peer string) error { p.mu.Unlock() }() // we set peer IPs to nil here as proxyguard already does a DNS request for us - return p.c.Tunnel(cctx, peer, nil) + return client.Tunnel(cctx, peer, nil) } // StartProxyguard starts proxyguard for proxied WireGuard connections |
