diff --git a/runtime/curl.cpp b/runtime/curl.cpp index 5017b244c0..2b57bd8183 100644 --- a/runtime/curl.cpp +++ b/runtime/curl.cpp @@ -1021,38 +1021,10 @@ void clear_contexts(array &contexts) { hard_reset_var(contexts); } -class CurlEpollFdTracker : vk::not_copyable { -public: - void add_fd(int fd) noexcept { - int64_t dummy{}; - used_fds_.emplace_value(fd, dummy); - } - - void remove_fd(int fd) noexcept { - used_fds_.unset(fd); - } - - void dispose_all_fds_from_epoll() noexcept { - for (auto it : used_fds_) { - int fd = it.get_int_key(); - epoll_remove(fd); - remove_fd(fd); - } - hard_reset_var(used_fds_); - } - -private: - CurlEpollFdTracker() = default; - friend class vk::singleton; - - array used_fds_; -}; - void free_curl_lib() noexcept { dl::CriticalSectionGuard critical_section; clear_contexts(vk::singleton::get().easy_contexts); clear_contexts(vk::singleton::get().multi_contexts); - vk::singleton::get().dispose_all_fds_from_epoll(); vk::singleton::get().total_allocated = 0; } @@ -1168,8 +1140,7 @@ static int curl_epoll_cb(int fd, void *data, event_t *ev) { } static int curl_socketfunction_cb(CURL */*easy*/, curl_socket_t fd, int action, void *userp, void */*socketp*/) { - dl::CriticalSectionGuard critical_section; - + dl::CriticalSectionGuard guard; auto *curl_request = static_cast(userp); php_assert(curl_request); @@ -1186,12 +1157,10 @@ static int curl_socketfunction_cb(CURL */*easy*/, curl_socket_t fd, int action, } epoll_insert(fd, events); epoll_sethandler(fd, 0, curl_epoll_cb, curl_request); - vk::singleton::get().add_fd(fd); break; } case CURL_POLL_REMOVE: { epoll_remove(fd); - vk::singleton::get().remove_fd(fd); break; } default: