Merge pull request #2228 from aria2/fix-build-failure

Use ares_socket_t where appropriate
master
Tatsuhiro Tsujikawa 2024-06-30 21:40:13 +09:00 committed by GitHub
commit e2eb5f82e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 11 deletions

View File

@ -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<AsyncNameResolver*>(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) {

View File

@ -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

View File

@ -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;

View File

@ -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);
};