Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[relay-client] Fix Relay disconnection handling #2680

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions client/internal/peer/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,13 +586,17 @@ func (conn *Conn) onWorkerRelayStateDisconnected() {
return
}

if conn.wgProxyRelay != nil {
log.Debugf("relayed connection is closed, clean up WireGuard config")
log.Debugf("relay connection is disconnected")

if conn.currentConnPriority == connPriorityRelay {
log.Debugf("clean up WireGuard config")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Debugf("clean up WireGuard config")
log.Debug("clean up WireGuard config")

err := conn.config.WgConfig.WgInterface.RemovePeer(conn.config.WgConfig.RemoteKey)
if err != nil {
conn.log.Errorf("failed to remove wg endpoint: %v", err)
}
}

if conn.wgProxyRelay != nil {
conn.endpointRelay = nil
_ = conn.wgProxyRelay.CloseConn()
conn.wgProxyRelay = nil
Expand Down
Loading