【修改】M26 模块域名解析响应时间为 14 秒
Signed-off-by: chenyong <1521761801@qq.com>
This commit is contained in:
parent
366d077535
commit
3409194356
|
@ -323,7 +323,9 @@ __exit:
|
|||
*/
|
||||
static int esp8266_domain_resolve(const char *name, char ip[16])
|
||||
{
|
||||
int result = RT_EOK;
|
||||
#define RESOLVE_RETRY 5
|
||||
|
||||
int i, result = RT_EOK;
|
||||
char recv_ip[16] = { 0 };
|
||||
at_response_t resp = RT_NULL;
|
||||
|
||||
|
@ -339,7 +341,8 @@ static int esp8266_domain_resolve(const char *name, char ip[16])
|
|||
|
||||
rt_mutex_take(at_event_lock, RT_WAITING_FOREVER);
|
||||
|
||||
__restart:
|
||||
for(i = 0; i < RESOLVE_RETRY; i++)
|
||||
{
|
||||
if (at_exec_cmd(resp, "AT+CIPDOMAIN=\"%s\"", name) < 0)
|
||||
{
|
||||
result = -RT_ERROR;
|
||||
|
@ -347,17 +350,27 @@ __restart:
|
|||
}
|
||||
|
||||
/* parse the third line of response data, get the IP address */
|
||||
at_resp_parse_line_args(resp, 1, "+CIPDOMAIN:%s", recv_ip);
|
||||
if(at_resp_parse_line_args(resp, at_resp_get_line_num_by_kw(resp, "+CIPDOMAIN:"),
|
||||
"+CIPDOMAIN:%s", recv_ip) < 0)
|
||||
{
|
||||
rt_thread_delay(rt_tick_from_millisecond(100));
|
||||
/* resolve failed, maybe receive an URC CRLF */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strlen(recv_ip) < 8)
|
||||
{
|
||||
rt_thread_delay(rt_tick_from_millisecond(100));
|
||||
/* resolve failed, maybe receive an URC CRLF */
|
||||
goto __restart;
|
||||
continue;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
strncpy(ip, recv_ip, 15);
|
||||
ip[15] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
__exit:
|
||||
rt_mutex_release(at_event_lock);
|
||||
|
@ -623,7 +636,12 @@ int esp8266_ping(int argc, char **argv)
|
|||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
at_resp_parse_line_args(resp, 1, "+%d", &req_time);
|
||||
if(at_resp_parse_line_args(resp, at_resp_get_line_num_by_kw(resp, "+"),
|
||||
"+%d", &req_time) < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (req_time)
|
||||
{
|
||||
rt_kprintf("32 bytes from %s icmp_seq=%d time=%d ms\n", argv[1], icmp_seq, req_time);
|
||||
|
|
|
@ -384,7 +384,8 @@ static int m26_domain_resolve(const char *name, char ip[16])
|
|||
RT_ASSERT(name);
|
||||
RT_ASSERT(ip);
|
||||
|
||||
resp = at_create_resp(128, 4, rt_tick_from_millisecond(5000));
|
||||
/* The maximum response time is 14 seconds, affected by network status */
|
||||
resp = at_create_resp(128, 4, rt_tick_from_millisecond(14 * 1000));
|
||||
if (!resp)
|
||||
{
|
||||
LOG_E("No memory for response structure!");
|
||||
|
|
Loading…
Reference in New Issue