Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/AsyncTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,10 @@ int8_t AsyncClient::abort() {
_tcp_abort(&_pcb, this);
// _pcb is now NULL
}
if (_discard_cb) {
// _pcb was closed here
_discard_cb(_discard_cb_arg, this);
}
Comment on lines +928 to +931
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@willmmiles: no sure if this block should be within the if (_pcb) { block or not. If yes, then maybe the same is true for close also and the latter should be updated too ?

What do you think ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#79 moved the _pcb check in AsyncClient::close() to be done just once in the LwIP context in _tcp_close_api, which then returns whether or not the dispose callback needs to be run after checking _pcb and the queue contents. The key reason is that _pcb could be nullptr while there's still a FIN or ERROR event pending, so even if it is, we need to purge the queue. I didn't want to replicate the purge code just to avoid the LwIP lock, though that would be a technically valid approach.

return ERR_ABRT;
}

Expand Down