diff --git a/src/AsyncNameResolver.cc b/src/AsyncNameResolver.cc index 8d4e2b23..09e85229 100644 --- a/src/AsyncNameResolver.cc +++ b/src/AsyncNameResolver.cc @@ -71,7 +71,7 @@ void callback(void* arg, int status, int timeouts, ares_addrinfo* result) } namespace { -void sock_state_cb(void* arg, int fd, int read, int write) +void sock_state_cb(void* arg, ares_socket_t fd, int read, int write) { auto resolver = static_cast(arg); @@ -79,7 +79,7 @@ void sock_state_cb(void* arg, int fd, int read, int write) } } // namespace -void AsyncNameResolver::handle_sock_state(int fd, int read, int write) +void AsyncNameResolver::handle_sock_state(ares_socket_t fd, int read, int write) { int events = 0; @@ -142,9 +142,9 @@ void AsyncNameResolver::resolve(const std::string& name) ares_getaddrinfo(channel_, name.c_str(), nullptr, &hints, callback, this); } -int AsyncNameResolver::getFds(fd_set* rfdsPtr, fd_set* wfdsPtr) const +ares_socket_t AsyncNameResolver::getFds(fd_set* rfdsPtr, fd_set* wfdsPtr) const { - auto nfds = 0; + ares_socket_t nfds = 0; for (const auto& ent : socks_) { if (ent.events & EventPoll::EVENT_READ) { diff --git a/src/AsyncNameResolver.h b/src/AsyncNameResolver.h index 065ef534..cc19260e 100644 --- a/src/AsyncNameResolver.h +++ b/src/AsyncNameResolver.h @@ -47,7 +47,7 @@ namespace aria2 { struct AsyncNameResolverSocketEntry { - int fd; + ares_socket_t fd; int events; }; @@ -89,7 +89,7 @@ public: STATUS getStatus() const { return status_; } - int getFds(fd_set* rfdsPtr, fd_set* wfdsPtr) const; + ares_socket_t getFds(fd_set* rfdsPtr, fd_set* wfdsPtr) const; void process(fd_set* rfdsPtr, fd_set* wfdsPtr); @@ -108,7 +108,7 @@ public: const std::string& getHostname() const { return hostname_; } - void handle_sock_state(int sock, int read, int write); + void handle_sock_state(ares_socket_t sock, int read, int write); }; } // namespace aria2 diff --git a/src/SelectEventPoll.cc b/src/SelectEventPoll.cc index d9397b20..42943ac0 100644 --- a/src/SelectEventPoll.cc +++ b/src/SelectEventPoll.cc @@ -129,8 +129,8 @@ SelectEventPoll::AsyncNameResolverEntry::AsyncNameResolverEntry( { } -int SelectEventPoll::AsyncNameResolverEntry::getFds(fd_set* rfdsPtr, - fd_set* wfdsPtr) +ares_socket_t SelectEventPoll::AsyncNameResolverEntry::getFds(fd_set* rfdsPtr, + fd_set* wfdsPtr) { return nameResolver_->getFds(rfdsPtr, wfdsPtr); } @@ -184,7 +184,7 @@ void SelectEventPoll::poll(const struct timeval& tv) for (auto& i : nameResolverEntries_) { auto& entry = i.second; - int fd = entry.getFds(&rfds, &wfds); + auto fd = entry.getFds(&rfds, &wfds); // TODO force error if fd == 0 if (fdmax_ < fd) { fdmax_ = fd; diff --git a/src/SelectEventPoll.h b/src/SelectEventPoll.h index c09f423f..bb7a2da2 100644 --- a/src/SelectEventPoll.h +++ b/src/SelectEventPoll.h @@ -142,7 +142,7 @@ private: command_ < entry.command_); } - int getFds(fd_set* rfdsPtr, fd_set* wfdsPtr); + ares_socket_t getFds(fd_set* rfdsPtr, fd_set* wfdsPtr); void process(fd_set* rfdsPtr, fd_set* wfdsPtr); };