mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-25 01:23:22 +01:00
[relay-client] Fix Relay disconnection handling (#2680)
* Fix Relay disconnection handling If has an active P2P connection meanwhile the Relay connection broken with the server then we removed the WireGuard peer configuration. * Change logs
This commit is contained in:
parent
24c0aaa745
commit
ee0ea86a0a
@ -586,13 +586,17 @@ func (conn *Conn) onWorkerRelayStateDisconnected() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if conn.wgProxyRelay != nil {
|
log.Debugf("relay connection is disconnected")
|
||||||
log.Debugf("relayed connection is closed, clean up WireGuard config")
|
|
||||||
|
if conn.currentConnPriority == connPriorityRelay {
|
||||||
|
log.Debugf("clean up WireGuard config")
|
||||||
err := conn.config.WgConfig.WgInterface.RemovePeer(conn.config.WgConfig.RemoteKey)
|
err := conn.config.WgConfig.WgInterface.RemovePeer(conn.config.WgConfig.RemoteKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
conn.log.Errorf("failed to remove wg endpoint: %v", err)
|
conn.log.Errorf("failed to remove wg endpoint: %v", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if conn.wgProxyRelay != nil {
|
||||||
conn.endpointRelay = nil
|
conn.endpointRelay = nil
|
||||||
_ = conn.wgProxyRelay.CloseConn()
|
_ = conn.wgProxyRelay.CloseConn()
|
||||||
conn.wgProxyRelay = nil
|
conn.wgProxyRelay = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user