MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _trigger_initial_ping_sweep

Method _trigger_initial_ping_sweep

wifi_manager.py:350–377  ·  view source on GitHub ↗

Schedule a post-connection ping sweep to refresh network data.

(self, ssid)

Source from the content-addressed store, hash-verified

348 First-time establishment (no active network yet) propagates immediately
349 so the per-network DB switches before the next scan cycle. Subsequent
350 *changes* between known SSIDs are debounced: a transient misread of
351 the SSID (common during roaming on Pi Zero) used to trip
352 mark_all_hosts_degraded() and wipe the entire target list.
353 """
354 self.current_ssid = ssid
355
356 if not hasattr(self.shared_data, 'set_active_network'):
357 return
358
359 active_ssid = getattr(self.shared_data, 'active_network_ssid', None)
360
361 # Same SSID as what storage already considers active → clear pending.
362 if ssid == active_ssid:
363 if self._pending_ssid_change is not None:
364 self.logger.debug(
365 f"SSID change to {self._pending_ssid_change} aborted "
366 f"(reverted to {active_ssid})")
367 self._pending_ssid_change = None
368 self._pending_ssid_first_seen = 0.0
369 return
370
371 # Fresh establishment from no active network → propagate immediately.
372 if not active_ssid:
373 self._propagate_active_network(ssid)
374 return
375
376 # Real change from one SSID to another → debounce.
377 now = time.time()
378 if self._pending_ssid_change != ssid:
379 self._pending_ssid_change = ssid
380 self._pending_ssid_first_seen = now

Callers 4

connect_to_networkMethod · 0.95

Calls 3

debugMethod · 0.80
infoMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected