From 1212289f0b9bdf81adda4846043be5ff3361070e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Villac=C3=ADs=20Lasso?= Date: Fri, 28 Oct 2022 14:01:55 -0500 Subject: [PATCH] Skip onPoll processing until socket is fully connected Previously there was a risk that an in-progress connection with a valid socket would be selected for polling and its installed onPoll callback invoked before the onConnect event arrives, resulting in potentially undefined behavior. Fixed by use of the standard connected() method. --- src/AsyncTCP.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AsyncTCP.cpp b/src/AsyncTCP.cpp index 217d862..21d777c 100644 --- a/src/AsyncTCP.cpp +++ b/src/AsyncTCP.cpp @@ -898,7 +898,7 @@ void AsyncClient::_sockIsReadable(void) void AsyncClient::_sockPoll(void) { - if (_socket == -1) return; + if (!connected()) return; uint32_t now = millis();