Dont start the ping until we are connected

Former-commit-id: 43c8a14fda
This commit is contained in:
Owen
2026-01-17 17:32:01 -08:00
parent a13010c4af
commit 17dc1b0be1
3 changed files with 29 additions and 2 deletions

View File

@@ -198,6 +198,9 @@ func (o *Olm) handleConnect(msg websocket.WSMessage) {
o.connected = true
// Start ping monitor now that we are registered and connected
o.websocket.StartPingMonitor()
// Invoke onConnected callback if configured
if o.olmConfig.OnConnected != nil {
go o.olmConfig.OnConnected()

View File

@@ -362,6 +362,8 @@ func (o *Olm) StartTunnel(config TunnelConfig) {
if o.connected {
logger.Debug("Already connected, skipping registration")
// Restart ping monitor on reconnect since the old one would have exited
o.websocket.StartPingMonitor()
return nil
}