1
0
Fork 0

reuse the same RLP header for every message

This commit is contained in:
Kevin Matz 2022-11-20 15:10:53 -05:00
parent 10031d3a05
commit ae838bee21
2 changed files with 5 additions and 5 deletions

View File

@ -36,6 +36,9 @@ namespace ACN::RLP {
Component::Component(UUID::uuid cid, std::string fctn)
: ACN::Component(cid, fctn)
{
/// All RLP PDU generated by this component will referance the same header.
rlp_header_ = std::make_shared<rlp_header>();
rlp_header_->cid = cid;
};
@ -147,14 +150,10 @@ void Component::rlpSend(ACN::RLP::message_transport& transport,
const PDU::Message<PDU::pdu_data> data,
const SDT::UDP::ipAddress& ip)
{
// rlp header
auto header = std::make_shared<RLP::rlp_header>();
header->cid = cid();
// rlp pdu
auto rlp = std::make_shared<RLP::Pdu>();
rlp->setVector(vector);
rlp->setHeader(header);
rlp->setHeader(rlp_header_);
rlp->setData(data);
// root block

View File

@ -71,6 +71,7 @@ protected:
private:
std::map<uint32_t, std::vector<PDU::Handler<RLP::Pdu>>> rlp_vectors_;
std::shared_ptr<rlp_header> rlp_header_;
};
}; // ACN::RLP