Send disconnecting message when stopping

Former-commit-id: 1fb6e2a00d
This commit is contained in:
Owen
2026-01-18 11:55:09 -08:00
parent 8b9ee6f26a
commit a8e0844758

View File

@@ -321,7 +321,7 @@ func (o *Olm) StartTunnel(config TunnelConfig) {
userToken, userToken,
config.OrgID, config.OrgID,
config.Endpoint, config.Endpoint,
30 * time.Second, // 30 seconds 30*time.Second, // 30 seconds
config.PingTimeoutDuration, config.PingTimeoutDuration,
websocket.WithPingDataProvider(func() map[string]any { websocket.WithPingDataProvider(func() map[string]any {
o.metaMu.Lock() o.metaMu.Lock()
@@ -479,6 +479,9 @@ func (o *Olm) StartTunnel(config TunnelConfig) {
} }
func (o *Olm) Close() { func (o *Olm) Close() {
// send a disconnect message to the cloud to show disconnected
o.websocket.SendMessage("olm/disconnecting", map[string]any{})
// Restore original DNS configuration // Restore original DNS configuration
// we do this first to avoid any DNS issues if something else gets stuck // we do this first to avoid any DNS issues if something else gets stuck
if err := dnsOverride.RestoreDNSOverride(); err != nil { if err := dnsOverride.RestoreDNSOverride(); err != nil {