OTA: Close and clean up client when setsockopt fails (#8865)

Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com>
This commit is contained in:
Lưu Oa Oa (宰相劉羅鍋) 2025-05-22 09:37:42 -07:00 committed by GitHub
parent 1ec57a74b5
commit 69da17742f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -111,6 +111,8 @@ void ESPHomeOTAComponent::handle_() {
int err = client_->setsockopt(IPPROTO_TCP, TCP_NODELAY, &enable, sizeof(int));
if (err != 0) {
ESP_LOGW(TAG, "Socket could not enable TCP nodelay, errno %d", errno);
client_->close();
client_ = nullptr;
return;
}