You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/04/27 05:38:17 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #892: Netdb multiple dns servers pr

xiaoxiang781216 commented on a change in pull request #892:
URL: https://github.com/apache/incubator-nuttx/pull/892#discussion_r415522746



##########
File path: libs/libc/netdb/lib_dnsaddserver.c
##########
@@ -198,10 +198,24 @@ int dns_add_nameserver(FAR const struct sockaddr *addr, socklen_t addrlen)
 {
   FAR uint16_t *pport;
   size_t copylen;
+  int nservers;
+  int idx;
 
   DEBUGASSERT(addr != NULL);
 
-  /* Copy the new server IP address into our private global data structure */
+  /* Get the index of the next free nameserver slot. */
+
+  dns_semtake();
+  if (g_dns_nservers == CONFIG_NETDB_DNSSERVER_NAMESERVERS)

Review comment:
       Should we pretend the new server to the beginning of the list? so we alwasy eliminate the oldest server and try the newest server in for each loop,




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org