We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 08f77e1 commit 527daa0Copy full SHA for 527daa0
features/netsocket/nsapi_dns.cpp
@@ -131,6 +131,13 @@ static bool dns_timer_running = false;
131
// DNS server configuration
132
extern "C" nsapi_error_t nsapi_dns_add_server(nsapi_addr_t addr, const char *interface_name)
133
{
134
+ // check if addr was already added
135
+ for (int i = 0; i < DNS_SERVERS_SIZE; i++) {
136
+ if (memcmp(&addr, &dns_servers[i], sizeof(nsapi_addr_t)) == 0) {
137
+ return NSAPI_ERROR_OK;
138
+ }
139
140
+
141
memmove(&dns_servers[1], &dns_servers[0],
142
(DNS_SERVERS_SIZE - 1)*sizeof(nsapi_addr_t));
143
0 commit comments