Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Commit e074eaa

Browse files
committed
fix poll could disconnect wrongly
1 parent 66fae4c commit e074eaa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/ESPAsyncTCP.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ AsyncClient::AsyncClient(tcp_pcb* pcb):
6868
{
6969
_pcb = pcb;
7070
if(_pcb){
71+
_rx_last_packet = millis();
7172
tcp_setprio(_pcb, TCP_PRIO_MIN);
7273
tcp_arg(_pcb, this);
7374
tcp_recv(_pcb, &_s_recv);
@@ -155,6 +156,7 @@ AsyncClient& AsyncClient::operator=(const AsyncClient& other){
155156

156157
_pcb = other._pcb;
157158
if (_pcb) {
159+
_rx_last_packet = millis();
158160
tcp_setprio(_pcb, TCP_PRIO_MIN);
159161
tcp_arg(_pcb, this);
160162
tcp_recv(_pcb, &_s_recv);
@@ -273,6 +275,7 @@ int8_t AsyncClient::_connected(void* pcb, int8_t err){
273275
_pcb = reinterpret_cast<tcp_pcb*>(pcb);
274276
if(_pcb){
275277
_pcb_busy = false;
278+
_rx_last_packet = millis();
276279
tcp_setprio(_pcb, TCP_PRIO_MIN);
277280
tcp_recv(_pcb, &_s_recv);
278281
tcp_sent(_pcb, &_s_sent);

0 commit comments

Comments
 (0)