Commit Graph

23 Commits

Author SHA1 Message Date
Alex Villacís Lasso
01f436bbcb Display actual core assignment for asyncTcpSock task
For ease of debugging.
2021-08-02 18:57:38 -05:00
Alex Villacís Lasso
16292c981e Update RX timestamp right after assigning socket
Otherwise the socket poll callback races with the RX timeout (if
nonzero) and will immediately disconnect the socket without waiting for
it to actually finish connecting.
2021-08-02 16:47:07 -05:00
Alex Villacís Lasso
fea600a56c Do not remove callbacks on socket error either
The general rule is that at no time must callbacks be removed from the
AsyncTCP object while the object is still live. Clients expect this from
the AsyncTCP library.
2021-07-29 18:01:10 -05:00
Alex Villacís Lasso
14dad4679c Merge branch 'master' of github.com:yubox-node-org/AsyncTCPSock 2021-07-16 14:19:41 -05:00
Alex Villacís Lasso
20460d62ba 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.
2021-07-16 14:19:04 -05:00
Alex Villacís Lasso
ca0d753698 Fix for absence of lwip_*_r functions in Arduino ESP 2.0.0-alpha 2021-06-19 18:28:41 -05:00
Alex Villacís Lasso
ddbeed4375 Revert "User ESP_IDF_VERSION_MAJOR for LwIP function conditional"
This reverts commit 93063fdb86.
2021-06-19 18:07:38 -05:00
Alex Villacís Lasso
93063fdb86 User ESP_IDF_VERSION_MAJOR for LwIP function conditional
The same way it is used in the standard ESP32 Arduino WiFi library.
2021-06-18 18:54:33 -05:00
Andrii
7168825854 Fixes #2 (#3)
* fixed reorder "error-as-warning"

* reverted code reformatting
2021-03-14 11:26:03 -05:00
Alex Villacís Lasso
0ad4a10c88 Flush some writable data on AsyncClient::send() 2021-02-27 20:55:02 -05:00
Alex Villacís Lasso
f69bcbd5ad Use recursive mutex, call callbacks with mutex held
Prior to this commit, the mutex that protected the global client socket
list was non-recursive. This forced the release of the mutex before
iterating through sockets on which to call callbacks. However, releasing
the mutex allowed destructors to proceed, therefore possibly
invalidating the object pointers copied to the local list. This in turn
risked calling callbacks on already destroyed objects. Fixed by the use
of a recursive mutex that allows holding the mutex during the callback
invocation.
2021-02-17 11:42:44 -05:00
Alex Villacís Lasso
d5cf17ff65 Clear write queue BEFORE calling discard callback
The discard callback (installed via onDisconnect()) can legitimately
decide to destroy the AsyncTCP client, calling the destructors which in
turn invalidate the write mutex object. Prior to this commit, calling
_clearWriteQueue() (which takes said write mutex) risked accessing
uninitialized memory and causing memory corruption. Fixed.
2021-02-16 19:54:43 -05:00
Alex Villacís Lasso
caefb971a4 Scrub write mutex ptr immediately after destroying it
In order to detect possible memory corruption.
2021-02-16 18:27:43 -05:00
Alex Villacís Lasso
36ceb07da4 Insert forgotten return statement 2021-02-16 17:31:19 -05:00
Alex Villacís Lasso
f9cce2dd8d Fix variable shadowing 2020-12-23 16:42:00 -05:00
Alex Villacís Lasso
ddd0bc9290 Clear all callbacks on close or error 2020-12-23 16:41:29 -05:00
Alex Villacís Lasso
c35a1f2079 Plug mutex semaphore leak
Introduced by previous commit. This prevents a leak of one mutex
semaphore structure per destroyed client socket.
2020-12-23 11:08:14 -05:00
Alex Villacís Lasso
2bb8788ec1 Protect write buffer queue with a per-client mutex
This prevents a race condicion of the ::add() method modifying the queue
and being preempted by the high-priority asyncTcpSock task that in turn
flushes the same queue to the socket, therefore modifying the queue.
2020-12-21 18:21:27 -05:00
Alex Villacís Lasso
9ee3bda5ae Add abort() support if enabled in LWIP 2020-12-21 14:04:00 -05:00
Alex Villacís Lasso
de2a0da915 Implement write() and free() methods
Also comment out one prototype not yet implemented.
2020-12-21 13:48:24 -05:00
Alex Villacís Lasso
7a70bda9ce Place code under the same license as original AsyncTCP 2020-12-21 13:16:21 -05:00
Alex Villacís Lasso
9bde555be8 Arduino library files 2020-12-21 12:59:04 -05:00
Alex Villacís Lasso
5f24debb27 Initial commit 2020-12-19 17:28:53 -05:00