0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 11:18:51 +02:00

modules/federation/sender: Use preallocated response content buffer.

This commit is contained in:
Jason Volk 2020-12-15 11:24:11 -08:00
parent 6f66ff5bac
commit 56ea0a14af

View file

@ -39,24 +39,29 @@ struct txndata
{} {}
}; };
struct txn struct alignas(32_KiB) txn
:txndata :txndata
,m::fed::send ,m::fed::send
{ {
struct node *node; struct node *node;
steady_point timeout; steady_point timeout;
char headers[8_KiB]; char buf[31_KiB];
txn(struct node &node, txn(struct node &node,
std::string content, std::string content,
m::fed::send::opts opts) m::fed::send::opts opts)
:txndata{std::move(content)} :txndata{std::move(content)}
,send{this->txnid, string_view{this->content}, this->headers, std::move(opts)} ,send{this->txnid, string_view{this->content}, this->buf, std::move(opts)}
,node{&node} ,node{&node}
,timeout{now<steady_point>()} //TODO: conf ,timeout{now<steady_point>()} //TODO: conf
{} {}
}; };
static_assert
(
sizeof(struct txn) == 32_KiB
);
struct node struct node
{ {
std::deque<std::shared_ptr<unit>> q; std::deque<std::shared_ptr<unit>> q;
@ -448,6 +453,7 @@ try
m::fed::send::opts opts; m::fed::send::opts opts;
opts.remote = remote; opts.remote = remote;
opts.dynamic = false;
opts.sopts = &sopts; opts.sopts = &sopts;
const vector_view<const json::value> pduv const vector_view<const json::value> pduv