Ignore EPOLL_CTL_DEL ENOENT, fix detection of the rollback version

This commit is contained in:
Vitaliy Filippov
2020-05-23 15:43:37 +03:00
parent 393fe75900
commit 6488d0044a
5 changed files with 19 additions and 9 deletions
+5 -2
View File
@@ -250,7 +250,10 @@ void osd_t::set_fd_handler(int fd, std::function<void(int, int)> handler)
}
else
{
epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fd, NULL);
if (epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fd, NULL) < 0 && errno != ENOENT)
{
throw std::runtime_error(std::string("epoll_ctl: ") + strerror(errno));
}
epoll_handlers.erase(fd);
}
}
@@ -416,7 +419,7 @@ void osd_t::stop_client(int peer_fd)
}
}
clients.erase(it);
if (epoll_ctl(epoll_fd, EPOLL_CTL_DEL, peer_fd, NULL) < 0)
if (epoll_ctl(epoll_fd, EPOLL_CTL_DEL, peer_fd, NULL) < 0 && errno != ENOENT)
{
throw std::runtime_error(std::string("epoll_ctl: ") + strerror(errno));
}