Prevent double start the guard code

This commit is contained in:
Zoltán Papp
2025-10-06 15:07:51 +02:00
parent ae78baade6
commit 28f8007d0f
+5
View File
@@ -807,7 +807,12 @@ func (conn *Conn) rosenpassDetermKey() (*wgtypes.Key, error) {
} }
func (conn *Conn) switchGuard() { func (conn *Conn) switchGuard() {
if conn.guardCtxCancel == nil {
return
}
conn.guardCtxCancel() conn.guardCtxCancel()
conn.guardCtxCancel = nil
conn.wgGuard.Wait() conn.wgGuard.Wait()
conn.wg.Add(1) conn.wg.Add(1)
go func() { go func() {