[ota] Implement host platform OTA backend with re-exec for integration testing (#16304)

This commit is contained in:
J. Nick Koston
2026-05-11 10:51:08 -05:00
committed by GitHub
parent 4ac7bc4606
commit a52ca4f80a
14 changed files with 664 additions and 27 deletions
@@ -14,7 +14,15 @@ namespace esphome::socket {
BSDSocketImpl::BSDSocketImpl(int fd, bool monitor_loop) {
this->fd_ = fd;
if (!monitor_loop || this->fd_ < 0)
if (this->fd_ < 0)
return;
#ifdef USE_HOST
// Release listening ports on OTA re-exec.
int flags = ::fcntl(this->fd_, F_GETFD, 0);
if (flags >= 0)
::fcntl(this->fd_, F_SETFD, flags | FD_CLOEXEC);
#endif
if (!monitor_loop)
return;
#ifdef USE_LWIP_FAST_SELECT
this->cached_sock_ = hook_fd_for_fast_select(this->fd_);