From 20460d62ba232b29d3b1e12552d47119ca45776c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Villac=C3=ADs=20Lasso?= Date: Fri, 16 Jul 2021 14:19:04 -0500 Subject: [PATCH] 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. --- src/AsyncTCP.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AsyncTCP.cpp b/src/AsyncTCP.cpp index 9188098..a2d3a37 100644 --- a/src/AsyncTCP.cpp +++ b/src/AsyncTCP.cpp @@ -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)