mirror of
https://github.com/esphome/esphome.git
synced 2026-10-11 22:04:16 +00:00
[ota] Implement host platform OTA backend with re-exec for integration testing (#16304)
This commit is contained in:
@@ -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_);
|
||||
|
||||
Reference in New Issue
Block a user