From 4d1387cac09d487e122dd890e7d3e719930832c8 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Sun, 27 Sep 2020 14:18:16 -0700 Subject: [PATCH] network: (merges !424) Handle additional SimpleNetDevice review comments --- src/network/utils/simple-net-device.cc | 10 ++++------ src/network/utils/simple-net-device.h | 9 ++++++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/network/utils/simple-net-device.cc b/src/network/utils/simple-net-device.cc index a8f55f403..5cdf5ea28 100644 --- a/src/network/utils/simple-net-device.cc +++ b/src/network/utils/simple-net-device.cc @@ -432,7 +432,6 @@ SimpleNetDevice::SendFrom (Ptr p, const Address& source, const Address& { return false; } - Ptr packet = p->Copy (); Mac48Address to = Mac48Address::ConvertFrom (dest); Mac48Address from = Mac48Address::ConvertFrom (source); @@ -448,12 +447,11 @@ SimpleNetDevice::SendFrom (Ptr p, const Address& source, const Address& { if (m_queue->GetNPackets () == 1 && !FinishTransmissionEvent.IsRunning ()) { - StartTransmission(); + StartTransmission (); } return true; } - return false; } @@ -471,11 +469,11 @@ SimpleNetDevice::StartTransmission () /** * SimpleChannel will deliver the packet to the far end(s) of the link as soon as Send is called * (or after its fixed delay, if one is configured). So we have to handle the rate of the link here, - * which we do by scheudling FinishTransmission (packetSize / linkRate) time in the future. While + * which we do by scheduling FinishTransmission (packetSize / linkRate) time in the future. While * that event is running, the transmit path of this NetDevice is busy, so we can't send other packets. * * SimpleChannel doesn't have a locking mechanism, and doesn't check for collisions, so there's nothing - * we need to do with the channel until the transmisison has "completed" from the perspective of this + * we need to do with the channel until the transmission has "completed" from the perspective of this * NetDevice. */ Time txTime = Time (0); @@ -500,7 +498,7 @@ SimpleNetDevice::FinishTransmission (Ptr packet) m_channel->Send (packet, proto, dst, src, this); - StartTransmission(); + StartTransmission (); return; } diff --git a/src/network/utils/simple-net-device.h b/src/network/utils/simple-net-device.h index 49a714f7d..431b304ec 100644 --- a/src/network/utils/simple-net-device.h +++ b/src/network/utils/simple-net-device.h @@ -158,11 +158,18 @@ private: */ TracedCallback > m_phyRxDropTrace; - void StartTransmission(void); + /** + * The StartTransmission method is used internally to start the process + * of sending a packet out on the channel, by scheduling the + * FinishTransmission method at a time corresponding to the transmission + * delay of the packet. + */ + void StartTransmission (void); /** * The FinishTransmission method is used internally to finish the process * of sending a packet out on the channel. + * \param packet The packet to send on the channel */ void FinishTransmission (Ptr packet);