[e131] Fix IGMP rejoin after effect stop/start cycle

When leave_() decremented consumers to 0 without removing the entry,
a subsequent join_() would find it, increment 0->1, and return early
without rejoining the IGMP multicast group. Now join_() only skips
the IGMP rejoin when consumers was already > 0.
This commit is contained in:
J. Nick Koston
2026-02-19 00:33:06 -06:00
parent 4bf13a8143
commit 1373f6866a
+5 -4
View File
@@ -98,12 +98,13 @@ void E131Component::join_(int universe) {
// store only latest received packet for the given universe
auto *consumer = this->find_universe_(universe);
if (consumer != nullptr) {
consumer->consumers++;
return; // we already joined before
if (consumer->consumers++ > 0) {
return; // we already joined before
}
} else {
this->universe_consumers_.push_back({static_cast<uint16_t>(universe), 1});
}
this->universe_consumers_.push_back({static_cast<uint16_t>(universe), 1});
if (this->join_igmp_groups_()) {
ESP_LOGD(TAG, "Joined %d universe for E1.31.", universe);
}