DNS recv/send returning WOULD_BLOCK force delayed retry

pull/9900/head
Michal Paszta 2019-02-27 16:50:11 +02:00
parent f8d254fc4c
commit ee056daf86
1 changed files with 8 additions and 1 deletions

View File

@ -1021,7 +1021,14 @@ static void nsapi_dns_query_async_send(void *ptr)
err = query->socket->sendto(dns_addr, packet, len);
if (err < 0) {
if (err == NSAPI_ERROR_WOULD_BLOCK) {
nsapi_dns_call_in(query->call_in_cb, DNS_TIMER_TIMEOUT, mbed::callback(nsapi_dns_query_async_send, ptr));
free(packet);
dns_mutex->unlock();
return; // Timeout handler will retry the connection if possible
} else {
query->dns_server++;
}
} else {
break;
}