Refactor ip address representation (#5252)

This commit is contained in:
Jimmy Hedman
2023-09-27 10:38:43 +02:00
committed by GitHub
parent 9d4f471855
commit 57b7dd0fa2
24 changed files with 225 additions and 175 deletions
+2 -10
View File
@@ -171,11 +171,7 @@ void MQTTClientComponent::start_dnslookup_() {
case ERR_OK: {
// Got IP immediately
this->dns_resolved_ = true;
#if LWIP_IPV6
this->ip_ = addr.u_addr.ip4.addr;
#else
this->ip_ = addr.addr;
#endif
this->ip_ = network::IPAddress(&addr);
this->start_connect_();
return;
}
@@ -226,11 +222,7 @@ void MQTTClientComponent::dns_found_callback(const char *name, const ip_addr_t *
if (ipaddr == nullptr) {
a_this->dns_resolve_error_ = true;
} else {
#if LWIP_IPV6
a_this->ip_ = ipaddr->u_addr.ip4.addr;
#else
a_this->ip_ = ipaddr->addr;
#endif
a_this->ip_ = network::IPAddress(ipaddr);
a_this->dns_resolved_ = true;
}
}