mirror of
https://github.com/matrix-construct/construct
synced 2024-07-15 06:58:36 +02:00
ircd::net::dns: Allocate separate reply buffer in resolver.
This commit is contained in:
parent
a3bea15eef
commit
30d8c0b961
|
@ -38,7 +38,7 @@ struct ircd::net::dns::resolver
|
||||||
|
|
||||||
ip::udp::socket ns; // A pollable activity object
|
ip::udp::socket ns; // A pollable activity object
|
||||||
ip::udp::endpoint reply_from; // Remote addr of recv
|
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 error_code &ec) const;
|
||||||
bool handle_error(const header &, const rfc1035::question &, tag &);
|
bool handle_error(const header &, const rfc1035::question &, tag &);
|
||||||
|
|
|
@ -2801,6 +2801,10 @@ ircd::net::dns::resolver::send_rate
|
||||||
|
|
||||||
ircd::net::dns::resolver::resolver()
|
ircd::net::dns::resolver::resolver()
|
||||||
:ns{*ircd::ios}
|
:ns{*ircd::ios}
|
||||||
|
,reply
|
||||||
|
{
|
||||||
|
64_KiB // worst-case UDP datagram size
|
||||||
|
}
|
||||||
,timeout_context
|
,timeout_context
|
||||||
{
|
{
|
||||||
"dnsres T", 64_KiB, std::bind(&resolver::timeout_worker, this), context::POST
|
"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)
|
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));
|
ns.async_receive_from(bufs, reply_from, std::move(handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3101,7 +3105,7 @@ noexcept try
|
||||||
|
|
||||||
char *const reply
|
char *const reply
|
||||||
{
|
{
|
||||||
this->reply
|
data(this->reply)
|
||||||
};
|
};
|
||||||
|
|
||||||
rfc1035::header &header
|
rfc1035::header &header
|
||||||
|
|
Loading…
Reference in a new issue