-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directly reset callbacks without going through lwip functions (fix #30) #31
Conversation
At least as I understood the documentation, LwIP frees the |
@me-no-dev suggested also another approach I will try, which is to immediately cleanup and after send the event in the queue (for the user callback only) |
You can skip most of the API cleanup as the pcb is about to be freed; none of the other callbacks will get called again anyways. The key cleanup is to invalidate the |
721c161
to
ac2970f
Compare
@willmmiles @me-no-dev : just a heads up for this issue / PR: We had 2 users having the issue (@hosseinaghaie and @moreArti - see #30). @moreArti was able to test and confirm that the initial fix works. The initial fix was just about cleaning up states without calling the lwip functions. void AsyncClient::_error(int8_t err) {
if (_pcb) {
TCP_MUTEX_LOCK();
tcp_arg(_pcb, NULL);
if (_pcb->state == LISTEN) {
// tcp_sent(_pcb, NULL);
_pcb->sent = NULL;
// tcp_recv(_pcb, NULL);
_pcb->recv = NULL;
// tcp_err(_pcb, NULL);
_pcb->errf = NULL;
// tcp_poll(_pcb, NULL, 0);
_pcb->poll = NULL;
_pcb->pollinterval = 0;
}
TCP_MUTEX_UNLOCK();
_free_closed_slot();
_pcb = NULL;
} I have update this PR yesterday to update the fix with something we discussed with @me-no-dev : cleanup earlier within the lwip thread and only do the callbacks from the async_tcp task. I am not sure about the Do you know ? Also, I have asked @moreArti to test again with this new fix. Thanks everybody! |
ac2970f
to
d98d1e2
Compare
fix #30