fix(network): bound link-transition teardown and gate Ethernet restarts
- Link down/switch edges now softDisconnect() every started slot instead of disconnect(). The full stop could wait forever for a DISCONNECTED event on the Core 0 MQTT task, and it destroyed and recreated every slot's esp-mqtt task on each Wi-Fi drop, where the bridge previously stopped none (measured: 62 s deauth, five slots, zero stops). softDisconnect() is bounded and keeps the task; reconnectSlotClient() then calls reconnect() on the new route. Rename the transition action to disconnect_started_slots to match. - Ethernet no-IP recovery and init retries rebuild the CH390 netif, so they now run inside the route-switch mutation gate. An OTA/WebConfig lock taken after maintain() samples the lock count can no longer have the interface torn down underneath it.
This commit is contained in:
1 parent
854d4e2ec3
commit
46f639cb1d
5 files changed
+26
-22
No files matched your search
@@ -573,8 +573,10 @@ class AutomaticNetworkLink final : public NetworkLink {
|
||||
_ethernet_retry_attempt.load(std::memory_order_relaxed);
|
||||
if (NetworkPolicy::ethernetInitRetryDue(
|
||||
attempt, now_ms,
|
||||
_last_ethernet_init_attempt.load(std::memory_order_relaxed))) {
|
||||
_last_ethernet_init_attempt.load(std::memory_order_relaxed)) &&
|
||||
beginUnlockedMutation()) {
|
||||
startOrRetryEthernet(now_ms, attempt != 0);
|
||||
endUnlockedMutation();
|
||||
}
|
||||
}
|
||||
// bootstrap() owns the initial choice. MQTT begin() is intentionally
|
||||
@@ -656,19 +658,25 @@ class AutomaticNetworkLink final : public NetworkLink {
|
||||
} else {
|
||||
_ethernet_no_ip_since.store(0, std::memory_order_relaxed);
|
||||
}
|
||||
// Restarts rebuild the CH390 netif, so they take the same mutation gate as
|
||||
// a route switch: an OTA/WebConfig lock taken after the sample above wins.
|
||||
if (!switching_locked && NetworkPolicy::ethernetNoIpRecoveryDue(
|
||||
ethernet_started, ethernet_link_up, _ethernet.isConnected(),
|
||||
now_ms, _ethernet_no_ip_since.load(std::memory_order_relaxed))) {
|
||||
now_ms, _ethernet_no_ip_since.load(std::memory_order_relaxed)) &&
|
||||
beginUnlockedMutation()) {
|
||||
ethernet_started = startOrRetryEthernet(now_ms, true);
|
||||
_ethernet_no_ip_since.store(0, std::memory_order_relaxed);
|
||||
endUnlockedMutation();
|
||||
}
|
||||
if (!ethernet_started && !switching_locked) {
|
||||
const uint8_t attempt =
|
||||
_ethernet_retry_attempt.load(std::memory_order_relaxed);
|
||||
if (NetworkPolicy::ethernetInitRetryDue(
|
||||
attempt, now_ms,
|
||||
_last_ethernet_init_attempt.load(std::memory_order_relaxed))) {
|
||||
_last_ethernet_init_attempt.load(std::memory_order_relaxed)) &&
|
||||
beginUnlockedMutation()) {
|
||||
ethernet_started = startOrRetryEthernet(now_ms, true);
|
||||
endUnlockedMutation();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user