face: eliminate Transport::Packet wrapper type
Refs: #4843
Change-Id: I5977be55e8bdac33c989e3b8523fea764f304c37
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index 2c077ba..067e2b7 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -73,7 +73,7 @@
void
TopologyLink::addFace(TopologyNode i, shared_ptr<Face> face)
{
- auto receiveCb = [this, i] (Block&& pkt) { transmit(i, std::move(pkt)); };
+ auto receiveCb = [this, i] (const Block& packet) { transmit(i, packet); };
auto ret = m_transports.emplace(std::piecewise_construct,
std::forward_as_tuple(i),
@@ -85,7 +85,7 @@
}
void
-TopologyLink::transmit(TopologyNode i, Block&& packet)
+TopologyLink::transmit(TopologyNode i, const Block& packet)
{
if (!m_isUp) {
return;
@@ -98,18 +98,12 @@
continue;
}
- this->scheduleReceive(p.second.transport, Block{packet});
+ getScheduler().schedule(m_delay, [packet, recipient = p.second.transport] {
+ recipient->receivePacket(packet);
+ });
}
}
-void
-TopologyLink::scheduleReceive(face::InternalTransportBase* recipient, Block&& packet)
-{
- getScheduler().schedule(m_delay, [=, pkt = std::move(packet)] () mutable {
- recipient->receivePacket(std::move(pkt));
- });
-}
-
TopologyAppLink::TopologyAppLink(shared_ptr<Face> forwarderFace)
: m_face(std::move(forwarderFace))
, m_forwarderTransport(static_cast<InternalForwarderTransport*>(m_face->getTransport()))
diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp
index da4e488..233c216 100644
--- a/tests/daemon/fw/topology-tester.hpp
+++ b/tests/daemon/fw/topology-tester.hpp
@@ -108,10 +108,7 @@
private:
void
- transmit(TopologyNode i, Block&& packet);
-
- void
- scheduleReceive(face::InternalTransportBase* recipient, Block&& packet);
+ transmit(TopologyNode i, const Block& packet);
private:
bool m_isUp = true;
@@ -120,7 +117,7 @@
class ReceiveProxy : public face::InternalTransportBase
{
public:
- using Callback = std::function<void(Block&&)>;
+ using Callback = std::function<void(const Block&)>;
explicit
ReceiveProxy(Callback cb)
@@ -129,9 +126,9 @@
}
void
- receivePacket(Block&& packet) final
+ receivePacket(const Block& packet) final
{
- m_cb(std::move(packet));
+ m_cb(packet);
}
private: