Unverified Commit 2aa85e32 authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Minor LWIPEthernet cleanup (#1906)

parent c4f36170
...@@ -32,7 +32,6 @@ bool __ethernetContextInitted = false; ...@@ -32,7 +32,6 @@ bool __ethernetContextInitted = false;
// Async context that pumps the ethernet controllers // Async context that pumps the ethernet controllers
static async_context_threadsafe_background_t lwip_ethernet_async_context_threadsafe_background; static async_context_threadsafe_background_t lwip_ethernet_async_context_threadsafe_background;
static async_at_time_worker_t ethernet_timeout_worker; static async_at_time_worker_t ethernet_timeout_worker;
static async_context_t *_context = nullptr; static async_context_t *_context = nullptr;
// Theoretically support multiple interfaces // Theoretically support multiple interfaces
...@@ -45,7 +44,7 @@ void ethernet_arch_lwip_begin() { ...@@ -45,7 +44,7 @@ void ethernet_arch_lwip_begin() {
return; return;
} }
#endif #endif
async_context_acquire_lock_blocking(&lwip_ethernet_async_context_threadsafe_background.core); async_context_acquire_lock_blocking(_context);
} }
void ethernet_arch_lwip_end() { void ethernet_arch_lwip_end() {
...@@ -55,7 +54,7 @@ void ethernet_arch_lwip_end() { ...@@ -55,7 +54,7 @@ void ethernet_arch_lwip_end() {
return; return;
} }
#endif #endif
async_context_release_lock(&lwip_ethernet_async_context_threadsafe_background.core); async_context_release_lock(_context);
} }
int __addEthernetPacketHandler(std::function<void(void)> _packetHandler) { int __addEthernetPacketHandler(std::function<void(void)> _packetHandler) {
......
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
const IPAddress& arg3 = IPADDR_NONE, const IPAddress& dns2 = IPADDR_NONE); const IPAddress& arg3 = IPADDR_NONE, const IPAddress& dns2 = IPADDR_NONE);
// two and one parameter version. 2nd parameter is DNS like in Arduino. IPv4 only // two and one parameter version. 2nd parameter is DNS like in Arduino. IPv4 only
boolean config(IPAddress local_ip, IPAddress dns = IPADDR_NONE); bool config(IPAddress local_ip, IPAddress dns = IPADDR_NONE);
// default mac-address is inferred from esp8266's STA interface // default mac-address is inferred from esp8266's STA interface
bool begin(const uint8_t* macAddress = nullptr, const uint16_t mtu = DEFAULT_MTU); bool begin(const uint8_t* macAddress = nullptr, const uint16_t mtu = DEFAULT_MTU);
...@@ -271,7 +271,7 @@ bool LwipIntfDev<RawDev>::config(const IPAddress& localIP, const IPAddress& gate ...@@ -271,7 +271,7 @@ bool LwipIntfDev<RawDev>::config(const IPAddress& localIP, const IPAddress& gate
} }
template<class RawDev> template<class RawDev>
boolean LwipIntfDev<RawDev>::config(IPAddress local_ip, IPAddress dns) { bool LwipIntfDev<RawDev>::config(IPAddress local_ip, IPAddress dns) {
if (!local_ip.isSet()) { if (!local_ip.isSet()) {
return config(INADDR_ANY, INADDR_ANY, INADDR_ANY); return config(INADDR_ANY, INADDR_ANY, INADDR_ANY);
......
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