[mdns] Fold the receive branch into the onRx handler

This commit is contained in:
J. Nick Koston
2026-09-05 21:31:05 +02:00
parent 28ec0441ea
commit a121bf17f0
+9 -11
View File
@@ -29,8 +29,15 @@ class GuardedMDNSResponder : public ::esp8266::MDNSImplementation::MDNSResponder
(this->*fn)();
return;
}
// Set every time: a restart replaces the context together with its stock handler
ctx->onRx([this]() { this->on_rx_(); });
// Set every time: a restart replaces the context together with its stock handler.
// Runs from lwIP in the SYS context.
ctx->onRx([this]() {
if (this->in_loop_call_) {
this->pending_rx_++;
} else {
this->_callProcess();
}
});
this->pending_rx_ = 0;
this->in_loop_call_ = true;
(this->*fn)();
@@ -42,15 +49,6 @@ class GuardedMDNSResponder : public ::esp8266::MDNSImplementation::MDNSResponder
this->in_loop_call_ = false;
}
// lwIP receive callback (SYS context)
void on_rx_() {
if (this->in_loop_call_) {
this->pending_rx_++;
} else {
this->_callProcess();
}
}
volatile bool in_loop_call_{false};
volatile uint8_t pending_rx_{0};
};