Fix #27: Required to lock TCPIP core functionality

This commit is contained in:
Mathieu Carbou
2024-10-27 08:37:58 +01:00
parent c4eac0999d
commit 45b7ee826b

View File

@@ -951,6 +951,7 @@ int8_t AsyncClient::_connected(tcp_pcb* pcb, int8_t err){
void AsyncClient::_error(int8_t err) { void AsyncClient::_error(int8_t err) {
if(_pcb){ if(_pcb){
TCP_MUTEX_LOCK();
tcp_arg(_pcb, NULL); tcp_arg(_pcb, NULL);
if(_pcb->state == LISTEN) { if(_pcb->state == LISTEN) {
tcp_sent(_pcb, NULL); tcp_sent(_pcb, NULL);
@@ -958,6 +959,7 @@ void AsyncClient::_error(int8_t err) {
tcp_err(_pcb, NULL); tcp_err(_pcb, NULL);
tcp_poll(_pcb, NULL, 0); tcp_poll(_pcb, NULL, 0);
} }
TCP_MUTEX_UNLOCK();
_free_closed_slot(); _free_closed_slot();
_pcb = NULL; _pcb = NULL;
} }