From 56ea0a14afeff83025190fcb36182d84847cb047 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 15 Dec 2020 11:24:11 -0800 Subject: [PATCH] modules/federation/sender: Use preallocated response content buffer. --- modules/federation/sender.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/federation/sender.cc b/modules/federation/sender.cc index 7b5ad8324..cf504cb6d 100644 --- a/modules/federation/sender.cc +++ b/modules/federation/sender.cc @@ -39,24 +39,29 @@ struct txndata {} }; -struct txn +struct alignas(32_KiB) txn :txndata ,m::fed::send { struct node *node; steady_point timeout; - char headers[8_KiB]; + char buf[31_KiB]; txn(struct node &node, std::string content, m::fed::send::opts opts) :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} ,timeout{now()} //TODO: conf {} }; +static_assert +( + sizeof(struct txn) == 32_KiB +); + struct node { std::deque> q; @@ -448,6 +453,7 @@ try m::fed::send::opts opts; opts.remote = remote; + opts.dynamic = false; opts.sopts = &sopts; const vector_view pduv