Add close test for all implementation

This commit is contained in:
Zoltán Papp
2025-02-17 21:47:34 +01:00
parent 360c7134f7
commit 1963644c99
2 changed files with 31 additions and 11 deletions

View File

@@ -110,6 +110,10 @@ func (p *ProxyBind) CloseConn() error {
}
func (p *ProxyBind) close() error {
if p.remoteConn == nil {
return nil
}
p.closeMu.Lock()
defer p.closeMu.Unlock()
@@ -125,7 +129,7 @@ func (p *ProxyBind) close() error {
p.pausedCond.L.Unlock()
p.pausedCond.Signal()
p.bind.RemoveEndpoint(bind.EndpointToUDPAddr(*p.wgCurrentUsed))
p.bind.RemoveEndpoint(bind.EndpointToUDPAddr(*p.wgRelayedEndpoint))
if rErr := p.remoteConn.Close(); rErr != nil && !errors.Is(rErr, net.ErrClosed) {
return rErr