1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-29 16:42:19 +01:00

Merge branch 'make_captive_portal_captive' into integration

This commit is contained in:
J. Nick Koston
2025-09-27 13:22:11 -05:00
2 changed files with 3 additions and 8 deletions

View File

@@ -83,12 +83,9 @@ void DNSServer::stop() {
void DNSServer::process_next_request() { void DNSServer::process_next_request() {
// Process one request if socket is valid and data is available // Process one request if socket is valid and data is available
if (this->socket_ != nullptr && this->socket_->ready()) { if (this->socket_ == nullptr || !this->socket_->ready()) {
this->process_dns_request(); return;
} }
}
void DNSServer::process_dns_request() {
struct sockaddr_in client_addr; struct sockaddr_in client_addr;
socklen_t client_addr_len = sizeof(client_addr); socklen_t client_addr_len = sizeof(client_addr);
@@ -110,7 +107,7 @@ void DNSServer::process_dns_request() {
ESP_LOGVV(TAG, "Received %d bytes from %s:%d", len, inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port)); ESP_LOGVV(TAG, "Received %d bytes from %s:%d", len, inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
if (len < sizeof(DNSHeader) + 1) { if (len < static_cast<ssize_t>(sizeof(DNSHeader) + 1)) {
ESP_LOGV(TAG, "Request too short: %d", len); ESP_LOGV(TAG, "Request too short: %d", len);
return; return;
} }

View File

@@ -17,8 +17,6 @@ class DNSServer {
protected: protected:
static constexpr size_t DNS_BUFFER_SIZE = 192; static constexpr size_t DNS_BUFFER_SIZE = 192;
void process_dns_request();
std::unique_ptr<socket::Socket> socket_{nullptr}; std::unique_ptr<socket::Socket> socket_{nullptr};
network::IPAddress server_ip_; network::IPAddress server_ip_;
uint8_t buffer_[DNS_BUFFER_SIZE]; uint8_t buffer_[DNS_BUFFER_SIZE];