Unverified Commit 4625d2c8 authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Avoid memory allocation in Ethernet callbacks (#1815)

std::bind can cause a memory allocation to occur during the periodic
polling interrupt which is a very bad thing.  Use a lambda instead.

Fixes #1812
parent db7ba160
...@@ -310,7 +310,7 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) { ...@@ -310,7 +310,7 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
return false; return false;
} }
_phID = __addEthernetPacketHandler(std::bind(&LwipIntfDev<RawDev>::handlePackets, this)); _phID = __addEthernetPacketHandler([this] { this->handlePackets(); });
if (localIP().v4() == 0) { if (localIP().v4() == 0) {
// IP not set, starting DHCP // IP not set, starting DHCP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment