mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
[socket] Add LWIP_LOCK to socket factory functions
tcp_new() is an lwip core API call that must be bracketed with the lwip lock on RP2040 per pico-sdk docs. Add LWIP_LOCK() to socket() and socket_listen() factory functions.
This commit is contained in:
@@ -781,6 +781,7 @@ std::unique_ptr<Socket> socket(int domain, int type, int protocol) {
|
||||
errno = EPROTOTYPE;
|
||||
return nullptr;
|
||||
}
|
||||
LWIP_LOCK();
|
||||
auto *pcb = tcp_new();
|
||||
if (pcb == nullptr)
|
||||
return nullptr;
|
||||
@@ -800,6 +801,7 @@ std::unique_ptr<ListenSocket> socket_listen(int domain, int type, int protocol)
|
||||
errno = EPROTOTYPE;
|
||||
return nullptr;
|
||||
}
|
||||
LWIP_LOCK();
|
||||
auto *pcb = tcp_new();
|
||||
if (pcb == nullptr)
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user