reuse the same RLP header for every message
This commit is contained in:
parent
10031d3a05
commit
ae838bee21
|
@ -36,6 +36,9 @@ namespace ACN::RLP {
|
||||||
Component::Component(UUID::uuid cid, std::string fctn)
|
Component::Component(UUID::uuid cid, std::string fctn)
|
||||||
: ACN::Component(cid, 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 PDU::Message<PDU::pdu_data> data,
|
||||||
const SDT::UDP::ipAddress& ip)
|
const SDT::UDP::ipAddress& ip)
|
||||||
{
|
{
|
||||||
// rlp header
|
|
||||||
auto header = std::make_shared<RLP::rlp_header>();
|
|
||||||
header->cid = cid();
|
|
||||||
|
|
||||||
// rlp pdu
|
// rlp pdu
|
||||||
auto rlp = std::make_shared<RLP::Pdu>();
|
auto rlp = std::make_shared<RLP::Pdu>();
|
||||||
rlp->setVector(vector);
|
rlp->setVector(vector);
|
||||||
rlp->setHeader(header);
|
rlp->setHeader(rlp_header_);
|
||||||
rlp->setData(data);
|
rlp->setData(data);
|
||||||
|
|
||||||
// root block
|
// root block
|
||||||
|
|
|
@ -71,6 +71,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<uint32_t, std::vector<PDU::Handler<RLP::Pdu>>> rlp_vectors_;
|
std::map<uint32_t, std::vector<PDU::Handler<RLP::Pdu>>> rlp_vectors_;
|
||||||
|
std::shared_ptr<rlp_header> rlp_header_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // ACN::RLP
|
}; // ACN::RLP
|
||||||
|
|
Loading…
Reference in New Issue