diff --git a/client/iface/wgproxy/bind/proxy.go b/client/iface/wgproxy/bind/proxy.go index b0dfef06b..6340b2d4f 100644 --- a/client/iface/wgproxy/bind/proxy.go +++ b/client/iface/wgproxy/bind/proxy.go @@ -161,17 +161,9 @@ func (p *ProxyBind) proxyToLocal(ctx context.Context) { return } - for { - p.pausedCond.L.Lock() - if p.paused { - p.pausedCond.Wait() - if !p.paused { - break - } - p.pausedCond.L.Unlock() - continue - } - break + p.pausedCond.L.Lock() + for p.paused { + p.pausedCond.Wait() } msg := bind.RecvMessage{ diff --git a/client/iface/wgproxy/ebpf/wrapper.go b/client/iface/wgproxy/ebpf/wrapper.go index a3ee8ac8f..98d14e80c 100644 --- a/client/iface/wgproxy/ebpf/wrapper.go +++ b/client/iface/wgproxy/ebpf/wrapper.go @@ -120,17 +120,9 @@ func (p *ProxyWrapper) proxyToLocal(ctx context.Context) { return } - for { - p.pausedCond.L.Lock() - if p.paused { - p.pausedCond.Wait() - if !p.paused { - break - } - p.pausedCond.L.Unlock() - continue - } - break + p.pausedCond.L.Lock() + for p.paused { + p.pausedCond.Wait() } err = p.wgeBPFProxy.sendPkg(buf[:n], p.wgEndpointCurrentUsedAddr)