This repository was archived by the owner on Jan 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ AsyncClient::AsyncClient(tcp_pcb* pcb):
52
52
, _ack_pcb(true )
53
53
, _rx_last_packet(0 )
54
54
, _rx_since_timeout(0 )
55
+ , _ack_timeout(ASYNC_MAX_ACK_TIME)
55
56
, _connect_port(0 )
56
57
, prev(NULL )
57
58
, next(NULL )
@@ -306,7 +307,7 @@ int8_t AsyncClient::_poll(tcp_pcb* pcb){
306
307
}
307
308
uint32_t now = millis ();
308
309
// ACK Timeout
309
- if (_pcb_busy && (now - _pcb_sent_at) >= ASYNC_MAX_ACK_TIME ){
310
+ if (_pcb_busy && _ack_timeout && (now - _pcb_sent_at) >= _ack_timeout ){
310
311
_pcb_busy = false ;
311
312
if (_timeout_cb)
312
313
_timeout_cb (_timeout_cb_arg, this , (now - _pcb_sent_at));
@@ -383,6 +384,14 @@ uint32_t AsyncClient::getRxTimeout(){
383
384
return _rx_since_timeout;
384
385
}
385
386
387
+ uint32_t AsyncClient::getAckTimeout (){
388
+ return _ack_timeout;
389
+ }
390
+
391
+ void AsyncClient::setAckTimeout (uint32_t timeout){
392
+ _ack_timeout = timeout;
393
+ }
394
+
386
395
void AsyncClient::setNoDelay (bool nodelay){
387
396
if (!_pcb)
388
397
return ;
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ class AsyncClient {
70
70
uint32_t _rx_ack_len;
71
71
uint32_t _rx_last_packet;
72
72
uint32_t _rx_since_timeout;
73
+ uint32_t _ack_timeout;
73
74
uint16_t _connect_port;
74
75
75
76
int8_t _close ();
@@ -129,6 +130,8 @@ class AsyncClient {
129
130
130
131
uint32_t getRxTimeout ();
131
132
void setRxTimeout (uint32_t timeout);// no RX data timeout for the connection in seconds
133
+ uint32_t getAckTimeout ();
134
+ void setAckTimeout (uint32_t timeout);// no ACK timeout for the last sent packet in milliseconds
132
135
void setNoDelay (bool nodelay);
133
136
bool getNoDelay ();
134
137
uint32_t getRemoteAddress ();
You can’t perform that action at this time.
0 commit comments