mirror of
https://github.com/fosrl/olm.git
synced 2026-07-15 21:42:43 -05:00
[PR #123] [CLOSED] Always re-register on WebSocket reconnect #1073
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fosrl/olm/pull/123
Author: @rinseaid
Created: 5/14/2026
Status: ❌ Closed
Base:
dev← Head:fix/re-register-on-reconnect-v2📝 Commits (1)
6c9cd42Always re-register on WebSocket reconnect📊 Changes
1 file changed (+22 additions, -24 deletions)
View changed files
📝
olm/olm.go(+22 -24)📄 Description
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Preface
This PR was developed with Claude Code (claude-opus-4-6). I identified the bug through live debugging of a broken Olm tunnel after a Pangolin server restart, traced the root cause through the code, and directed the fix. Claude wrote the patch. I reviewed and validated all changes.
Description
After a Pangolin server restart (or any WebSocket disconnect/reconnect cycle), Olm clients fail to re-register with the server, leaving the WireGuard tunnel broken. The user must manually disconnect and reconnect to restore connectivity.
Root cause: The
OnConnectcallback inStartTunnelcheckso.registeredand returns early if it istrue. However,o.registeredis only reset tofalsebyStopTunnel(). When the WebSocket reconnects (server restart, network interruption), the callback fires again buto.registeredis stilltruefrom the previous connection, so registration is skipped entirely.The server has lost all in-memory state (including
clientConfigVersionsand the client's WireGuard peer entry), so the client must re-register to restore the tunnel. Skipping registration leaves the client in a state where it believes it is registered but the server has no record of it.Fix: Remove the
o.registeredearly-return guard and always re-register on reconnect. Cancel any in-flightSendMessageIntervalfrom a previous connection before starting a new one.Related issues: #7, #72, #108
Companion PR: fosrl/pangolin#3069
How to test?
docker restart pangolin).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.