Skip to content

Commit

Permalink
net/proxy/ares unuse dynamic array as not supported by msvc
Browse files Browse the repository at this point in the history
  • Loading branch information
iceboy233 committed Dec 22, 2023
1 parent f70c7d7 commit 21d377e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions net/proxy/ares/resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void Resolver::wait() {
}

void Resolver::set_servers(absl::Span<const Endpoint> servers) {
ares_addr_port_node nodes[servers.size()];
auto nodes = std::make_unique<ares_addr_port_node[]>(servers.size());
for (size_t i = 0; i < servers.size(); ++i) {
nodes[i].next = i + 1 < servers.size() ? &nodes[i + 1] : nullptr;
const address &address = servers[i].address();
Expand All @@ -114,7 +114,7 @@ void Resolver::set_servers(absl::Span<const Endpoint> servers) {
nodes[i].udp_port = servers[i].port();
nodes[i].tcp_port = servers[i].port();
}
if (ares_set_servers_ports(channel_, nodes) != ARES_SUCCESS) {
if (ares_set_servers_ports(channel_, nodes.get()) != ARES_SUCCESS) {
abort();
}
}
Expand Down
3 changes: 2 additions & 1 deletion net/tools/ares-resolve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ int main(int argc, char *argv[]) {
io_context io_context;
auto executor = io_context.get_executor();
proxy::system::Connector connector(executor, {});
BlockingResult<std::error_code, std::vector<address>> results[argc - 1];
auto results = std::make_unique<
BlockingResult<std::error_code, std::vector<address>>[]>(argc - 1);
for (int i = 1; i < argc; ++i) {
connector.resolver().resolve(argv[i], results[i - 1].callback());
}
Expand Down

0 comments on commit 21d377e

Please sign in to comment.