Do not remove callbacks on socket close

Users of AsyncTCP expect callbacks installed on the object to remain
active on close event and do not reinstall them if the just-closed
object is reopened. Fixes failure to react to events after reopening.
This commit is contained in:
Alex Villacís Lasso
2021-07-16 14:19:04 -05:00
parent ddbeed4375
commit 20460d62ba

View File

@@ -285,6 +285,7 @@ AsyncClient::AsyncClient(int sockfd)
AsyncClient::~AsyncClient()
{
if (_socket != -1) _close();
_removeAllCallbacks();
vSemaphoreDelete(_write_mutex);
_write_mutex = NULL;
}
@@ -741,7 +742,6 @@ void AsyncClient::_close(void)
_clearWriteQueue();
if (_discard_cb) _discard_cb(_discard_cb_arg, this);
_removeAllCallbacks();
}
void AsyncClient::_error(int8_t err)