diff --git a/esphome/components/esphome/ota/ota_esphome.cpp b/esphome/components/esphome/ota/ota_esphome.cpp index 445167f13e..8edcba99c9 100644 --- a/esphome/components/esphome/ota/ota_esphome.cpp +++ b/esphome/components/esphome/ota/ota_esphome.cpp @@ -171,7 +171,7 @@ void ESPHomeOTAComponent::handle_handshake_() { if (read == -1) { this->log_socket_error_(LOG_STR("reading magic bytes")); } else { - ESP_LOGW(TAG, "Remote closed during handshake"); + this->log_remote_closed_(LOG_STR("handshake")); } this->cleanup_connection_(); return; @@ -247,7 +247,7 @@ void ESPHomeOTAComponent::handle_handshake_() { if (read == -1) { this->log_socket_error_(LOG_STR("reading features")); } else { - ESP_LOGW(TAG, "Remote closed during feature read"); + this->log_remote_closed_(LOG_STR("feature read")); } this->cleanup_connection_(); return; @@ -590,6 +590,10 @@ void ESPHomeOTAComponent::log_start_(const LogString *phase) { ESP_LOGD(TAG, "Starting %s from %s", LOG_STR_ARG(phase), this->client_->getpeername().c_str()); } +void ESPHomeOTAComponent::log_remote_closed_(const LogString *during) { + ESP_LOGW(TAG, "Remote closed during %s", LOG_STR_ARG(during)); +} + void ESPHomeOTAComponent::cleanup_connection_() { this->client_->close(); this->client_ = nullptr; diff --git a/esphome/components/esphome/ota/ota_esphome.h b/esphome/components/esphome/ota/ota_esphome.h index 02e759c2ba..f50444c6ce 100644 --- a/esphome/components/esphome/ota/ota_esphome.h +++ b/esphome/components/esphome/ota/ota_esphome.h @@ -49,6 +49,7 @@ class ESPHomeOTAComponent : public ota::OTAComponent { void log_socket_error_(const LogString *msg); void log_read_error_(const LogString *what); void log_start_(const LogString *phase); + void log_remote_closed_(const LogString *during); void cleanup_connection_(); void yield_and_feed_watchdog_();