From cbe90b5dd94bf715a9da1b1538a8123d97121eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Fri, 2 Aug 2024 09:50:42 +0200 Subject: [PATCH] Fix wg update --- client/internal/peer/conn.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/internal/peer/conn.go b/client/internal/peer/conn.go index af8e551db..d68766995 100644 --- a/client/internal/peer/conn.go +++ b/client/internal/peer/conn.go @@ -442,6 +442,7 @@ func (conn *Conn) iCEConnectionIsReady(priority ConnPriority, iceConnInfo ICECon conn.log.Warnf("Failed to update wg peer configuration: %v", err) return } + wgConfigWorkaround() if conn.wgProxyICE != nil { if err := conn.wgProxyICE.CloseConn(); err != nil { @@ -538,6 +539,7 @@ func (conn *Conn) relayConnectionIsReady(rci RelayConnInfo) { conn.log.Errorf("Failed to update wg peer configuration: %v", err) return } + wgConfigWorkaround() if conn.wgProxyRelay != nil { if err := conn.wgProxyRelay.CloseConn(); err != nil { @@ -757,3 +759,9 @@ func (conn *Conn) getEndpointForICEConnInfo(iceConnInfo ICEConnInfo) (net.Addr, func isRosenpassEnabled(remoteRosenpassPubKey []byte) bool { return remoteRosenpassPubKey != nil } + +// wgConfigWorkaround is a workaround for the issue with WireGuard configuration update +// When update a peer configuration in near to each other time, the second update can be ignored by WireGuard +func wgConfigWorkaround() { + time.Sleep(100 * time.Millisecond) +}