0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-04 17:48:35 +02:00

ircd::net::dns: Allocate separate reply buffer in resolver.

This commit is contained in:
Jason Volk 2018-04-28 17:21:30 -07:00
parent a3bea15eef
commit 30d8c0b961
2 changed files with 7 additions and 3 deletions

View file

@ -38,7 +38,7 @@ struct ircd::net::dns::resolver
ip::udp::socket ns; // A pollable activity object
ip::udp::endpoint reply_from; // Remote addr of recv
char reply[64_KiB] alignas(16); // Buffer for recv
unique_buffer<mutable_buffer> reply; // Buffer for recv
bool handle_error(const error_code &ec) const;
bool handle_error(const header &, const rfc1035::question &, tag &);

View file

@ -2801,6 +2801,10 @@ ircd::net::dns::resolver::send_rate
ircd::net::dns::resolver::resolver()
:ns{*ircd::ios}
,reply
{
64_KiB // worst-case UDP datagram size
}
,timeout_context
{
"dnsres T", 64_KiB, std::bind(&resolver::timeout_worker, this), context::POST
@ -3074,7 +3078,7 @@ ircd::net::dns::resolver::set_handle()
std::bind(&resolver::handle, this, ph::_1, ph::_2)
};
const asio::mutable_buffers_1 bufs{reply, sizeof(reply)};
const asio::mutable_buffers_1 bufs{reply};
ns.async_receive_from(bufs, reply_from, std::move(handler));
}
@ -3101,7 +3105,7 @@ noexcept try
char *const reply
{
this->reply
data(this->reply)
};
rfc1035::header &header