This repository was archived by the owner on Jan 20, 2025. It is now read-only.
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
void AsyncClient::_error(err_t err) - implementation error that could lead to crashes? #94
Closed
Description
I see that the lwip error callback is doing a few things on the _pcb data structure.
Page http://lwip.wikia.com/wiki/Raw/TCP) mentions, in bold:
The error callback function does not get the pcb passed to it as a parameter since the pcb may already have been deallocated.
So, If I undestand correctly, nothing should be done on the pcb data structure, since it might be already invalid (or will get soon to be invalid).
As such, all the code:
tcp_arg(_pcb, NULL);
tcp_sent(_pcb, NULL);
tcp_recv(_pcb, NULL);
tcp_err(_pcb, NULL);
tcp_poll(_pcb, NULL, 0);
seems to me to be incorrect and could get you into crashes.
The only thing to be done in that callback is probably to set _pcb = NULL and call user's callback(s) if set.