@@ -29,7 +29,9 @@ extern "C"{
29
29
#include " lwip/dns.h"
30
30
#include " lwip/err.h"
31
31
}
32
+ #if CONFIG_ASYNC_TCP_USE_WDT
32
33
#include " esp_task_wdt.h"
34
+ #endif
33
35
34
36
/*
35
37
* TCP/IP Event Task
@@ -238,7 +240,7 @@ static bool _start_async_task(){
238
240
return false ;
239
241
}
240
242
if (!_async_service_task_handle){
241
- customTaskCreateUniversal (_async_service_task, " async_tcp" , 8192 * 2 , NULL , 3 , &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE);
243
+ customTaskCreateUniversal (_async_service_task, " async_tcp" , CONFIG_ASYNC_TCP_STACK_SIZE , NULL , 3 , &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE);
242
244
if (!_async_service_task_handle){
243
245
return false ;
244
246
}
@@ -704,8 +706,12 @@ bool AsyncClient::connect(IPAddress ip, uint16_t port){
704
706
}
705
707
706
708
ip_addr_t addr;
709
+ #if LWIP_IPV4 && LWIP_IPV6
707
710
addr.type = IPADDR_TYPE_V4;
708
711
addr.u_addr .ip4 .addr = ip;
712
+ #else
713
+ addr.addr = ip;
714
+ #endif
709
715
710
716
tcp_pcb* pcb = tcp_new_ip_type (IPADDR_TYPE_V4);
711
717
if (!pcb){
@@ -733,7 +739,11 @@ bool AsyncClient::connect(const char* host, uint16_t port){
733
739
734
740
err_t err = dns_gethostbyname (host, &addr, (dns_found_callback)&_tcp_dns_found, this );
735
741
if (err == ERR_OK) {
742
+ #if LWIP_IPV4 && LWIP_IPV6
736
743
return connect (IPAddress (addr.u_addr .ip4 .addr ), port);
744
+ #else
745
+ return connect (IPAddress (addr.addr ), port);
746
+ #endif
737
747
} else if (err == ERR_INPROGRESS) {
738
748
_connect_port = port;
739
749
return true ;
@@ -998,8 +1008,13 @@ int8_t AsyncClient::_poll(tcp_pcb* pcb){
998
1008
}
999
1009
1000
1010
void AsyncClient::_dns_found (struct ip_addr *ipaddr){
1011
+ #if LWIP_IPV4 && LWIP_IPV6
1001
1012
if (ipaddr && ipaddr->u_addr .ip4 .addr ){
1002
1013
connect (IPAddress (ipaddr->u_addr .ip4 .addr ), _connect_port);
1014
+ #else
1015
+ if (ipaddr && ipaddr->addr ){
1016
+ connect (IPAddress (ipaddr->addr ), _connect_port);
1017
+ #endif
1003
1018
} else {
1004
1019
if (_error_cb) {
1005
1020
_error_cb (_error_cb_arg, this , -55 );
@@ -1088,7 +1103,11 @@ uint32_t AsyncClient::getRemoteAddress() {
1088
1103
if (!_pcb) {
1089
1104
return 0 ;
1090
1105
}
1106
+ #if LWIP_IPV4 && LWIP_IPV6
1091
1107
return _pcb->remote_ip .u_addr .ip4 .addr ;
1108
+ #else
1109
+ return _pcb->remote_ip .addr ;
1110
+ #endif
1092
1111
}
1093
1112
1094
1113
uint16_t AsyncClient::getRemotePort () {
@@ -1102,7 +1121,11 @@ uint32_t AsyncClient::getLocalAddress() {
1102
1121
if (!_pcb) {
1103
1122
return 0 ;
1104
1123
}
1124
+ #if LWIP_IPV4 && LWIP_IPV6
1105
1125
return _pcb->local_ip .u_addr .ip4 .addr ;
1126
+ #else
1127
+ return _pcb->local_ip .addr ;
1128
+ #endif
1106
1129
}
1107
1130
1108
1131
uint16_t AsyncClient::getLocalPort () {
@@ -1298,8 +1321,12 @@ void AsyncServer::begin(){
1298
1321
}
1299
1322
1300
1323
ip_addr_t local_addr;
1324
+ #if LWIP_IPV4 && LWIP_IPV6
1301
1325
local_addr.type = IPADDR_TYPE_V4;
1302
1326
local_addr.u_addr .ip4 .addr = (uint32_t ) _addr;
1327
+ #else
1328
+ local_addr.addr = (uint32_t ) _addr;
1329
+ #endif
1303
1330
err = _tcp_bind (_pcb, &local_addr, _port);
1304
1331
1305
1332
if (err != ERR_OK) {
0 commit comments