Skip to main content

Connectivity Detection & Monitoring


For Users

The GetApp Agent automatically detects when your device gains or loses network connectivity. You do not need to manually trigger syncs or tell the agent to "go online."

What happens automatically

  • When your device connects to a network (Ethernet cable, WiFi, VPN), the agent detects it within seconds and begins syncing software updates, offerings, and configurations with the server.
  • When connectivity is lost, the agent pauses all network operations gracefully and waits for the next opportunity.
  • If your device moves through areas with brief connectivity windows (e.g., a vehicle passing a base station), the agent is optimized to detect these windows as fast as possible — typically under 1 second — and immediately starts working.
  • All of this happens in the background. The UI connection indicator updates automatically.

Connection status indicators

IndicatorMeaning
🟢 ConnectedAgent can reach the server and is actively syncing
🟡 Internet onlyInternet is available but the GetApp server is unreachable
🔴 DisconnectedNo network connectivity detected
tip

If the agent seems stuck in "Disconnected" state even though you have network, check that the server URL is correctly configured. The agent distinguishes between "network exists" and "server is reachable."


For Technicians


Overview & Detection Flow

The Connectivity Scanner is a background service that continuously monitors the device's network state and notifies the rest of the agent when connectivity changes. It uses an adaptive, event-driven approach optimized for environments with intermittent connectivity.

Two operating modes

ModeWhen activeCheck intervalWhat it checks
ScanningDevice is disconnected5 seconds (configurable)Does a default gateway exist? (routing table check)
MonitoringDevice is connected60 seconds (configurable)Is the server still reachable? (full HTTP check)

Detection flow:

OS network-change event fires (instant, zero CPU cost)


Gateway exists in routing table?

NO ──┘ YES
│ │
Wait for ▼
next event Full connectivity check
├── Server reachable? → Connected! Start syncing
└── Internet only? → Keep scanning

On supported platforms (Windows and Linux), the agent listens for operating system network-change events — hardware interrupts that fire when a cable is plugged in, WiFi associates, or an IP address is assigned. This provides near-instant detection (under 100 milliseconds) with zero CPU cost while waiting.

On platforms without OS event support, the agent falls back to a timer-based poll every 5 seconds using a lightweight gateway probe.

What triggers an OS event

EventExample
Network adapter enabled/disabledEthernet cable plugged in, WiFi turned on/off
IP address assigned/removedDHCP lease obtained, static IP configured
Route added/removedDefault gateway appears in routing table
VPN tunnel established/torn downVPN client connects/disconnects

Why Adaptive Scanning Matters

Maximizing brief connectivity windows

Mobile and tactical devices often pass through areas with only seconds of connectivity. A fixed-interval poll (e.g., every 60 seconds) would waste most of that window just discovering the network exists. The adaptive scanner solves this by checking aggressively when disconnected and relaxing when connected.

Two-speed behavior

  • When disconnected — the agent probes every 5 seconds using a cheap check (routing table read, no network I/O). With OS events, detection is instant.
  • When connected — the agent relaxes to a 60-second verification interval, because active HTTP requests (deliveries, status updates) naturally surface failures.
  • The transition is automatic — as soon as the server becomes unreachable, the agent switches back to fast scanning mode.

Why gateway detection comes first

Checking "can I reach the GetApp server?" is expensive — it requires an HTTP request that can hang for several seconds if the network is down. Checking "does a default gateway exist in my routing table?" is free — it reads OS data structures in microseconds. The gateway check acts as a fast gate: if there's no gateway, there's no point trying the server.


Architecture & Integration Points

System diagram

┌─────────────────────────────────────────────────────────┐
│ Connectivity Scanner │
│ (src/common/client/connectivity/) │
│ │
│ Inputs: │
│ ├── OS network events (Windows / Linux) │
│ ├── Timer fallback (5s / 60s) │
│ └── Settings: connection_refresh_enabled, │
│ connection_refresh_interval_secs, │
│ scan_interval_secs, scan_gateway_timeout_ms │
│ │
│ Outputs: │
│ └── ServerPool::set_network_status() │
│ ├── watch channel → OnlineActor, Delivery, │
│ │ Orchestration, Schedule, │
│ │ Bandwidth │
│ ├── SSE broadcast → UI │
│ └── Matomo event → Analytics │
└─────────────────────────────────────────────────────────┘

Direct dependencies

DependencyPurpose
ServerPool / HttpClientPerforms the full connectivity check (server + internet)
SettingsIOReads scan intervals, timeouts, enabled flag
netdev crateReads OS routing table to discover gateway IPs
windows crate (Windows)Registers NotifyIpInterfaceChange callback
rtnetlink crate (Linux)Subscribes to kernel Netlink events

Downstream consumers

All consumers react automatically via the watch channel:

ConsumerReaction to connectivity change
OnlineActorUnblocks parked wait_for_online() tasks
Delivery ManagerStarts/resumes software downloads
Orchestration ManagerReconnects to parent agent (A2A)
Schedule ManagerResumes scheduled tasks
Bandwidth ServiceBegins bandwidth measurements
SSE BroadcasterPushes NetworkConnectionState event to UI
run_with_disconnect_cancel()Cancels in-flight requests on disconnect

Relationship to connection_refresh

The connectivity scanner replaces the older connection_refresh service. At server boot only connectivity::start() runs — it is the sole detection mechanism. The connection_refresh module still exists in the codebase but is no longer started. The scanner reuses the same two settings for its master toggle and its connected-mode monitoring interval: network.connection_refresh_enabled and network.connection_refresh_interval_secs.


Configuration, Tuning & Troubleshooting

Deployment scenarios

ScenarioBenefit
Vehicle passing through a base station coverage zoneSub-second detection, maximum sync window utilization
Field device with intermittent WiFiAutomatic reconnect without manual intervention
Device switching between Ethernet and WiFiOS event triggers immediate re-evaluation of connectivity
Air-gapped device briefly connected for updatesFast detection ensures the short window is fully used

Settings reference

# Master toggle — turns the scanner on/off
NETWORK_CONNECTION_REFRESH_ENABLED=true

# Monitoring interval when connected (seconds)
NETWORK_CONNECTION_REFRESH_INTERVAL_SECS=60

# Scanning interval when disconnected (seconds) — lower = faster detection
NETWORK_SCAN_INTERVAL_SECS=5

# Gateway TCP probe timeout (milliseconds) — used in timer fallback path
NETWORK_SCAN_GATEWAY_TIMEOUT_MS=500

Tuning recommendations

SettingWhen to changeRecommendation
scan_interval_secsDevice moves through very brief windows (<10s)Lower to 2-3s. Cost is negligible.
scan_interval_secsDevice is stationary with stable connectivityRaise to 10-15s to reduce log noise
connection_refresh_interval_secsServer health checks are too frequentThis is a safety-net timeout, not the primary detection mechanism. OS events handle fast detection. Safe to raise to 300s (5 min) or higher. Default 60s is conservative.
scan_gateway_timeout_msGateway is slow to respond (satellite link)Raise to 1000-2000ms
connection_refresh_enabledTesting without connectivity scanningSet to false. Scanner sleeps, no probes run
Runtime toggle

All settings can be changed at runtime via config.yaml or a server push. The scanner re-reads settings on every loop iteration — no restart required.

Edge cases and troubleshooting

SymptomLikely causeFix
Agent does not detect connectivityconnection_refresh_enabled is false (default)Set to true in .env or config.yaml
Detection is slow (>10 seconds)OS events failed to initializeCheck logs for connectivity_scanner: failed to init. Falls back to timer polling
Agent detects LAN but not serverServer URL is wrong, or server is downCheck network.getapp_server_urls in config. Verify server is reachable manually
Gateway probe gives false positivesStatic IP with stale gateway routeThe full server check catches this. No action needed
Multiple interfaces, wrong one detectedNot applicable — scanner checks all interfacesAll gateways from all interfaces are probed
Logs show constant "netlink event received"Normal on Linux — DHCP renewals, IPv6 neighbor discoveryThese are trace! level, only visible if log level is set to trace