diff --git a/CHANGES.md b/CHANGES.md index 68a59e26d..0fdd75d24 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -31,6 +31,7 @@ application model is added. Applications have a new Attribute to set the IPv4 ToS field. * (core) Deprecated enum `TestDuration` in `TestCase` class. It has been replaced by enum class `Duration`. * (core) In `TestSuite` class, deprecated `ALL`, `UNIT`, `SYSTEM`, `EXAMPLE` and `PERFORMANCE`. They have been replaced by `Type::ALL`, `Type::UNIT`, `Type::SYSTEM`, `Type::EXAMPLE` and `Type::PERFORMANCE`, respectively. +* (core) Deprecated `EventId::IsRunning()`. It has been replaced with `EventId::IsPending()`. * (wifi) Deprecated `WIFI_TID_TO_LINK_MAPPING_{NOT_SUPPORTED,SAME_LINK_SET,ANY_LINK_SET}`. They have been replaced by `WifiTidToLinkMappingNegSupport::{NOT_SUPPORTED,SAME_LINK_SET,ANY_LINK_SET}`, respectively. * (wifi) Deprecated `{IDLE, CCA_BUSY, TX, RX, SWITCHING, SLEEP, OFF}`. They have been replaced by `WifiPhyState::{IDLE, CCA_BUSY, TX, RX, SWITCHING, SLEEP, OFF}`, respectively. * (lr-wpan) `MacPibAttributeIdentifier` attribute ids are now standard compliant. diff --git a/doc/tutorial/source/tracing.rst b/doc/tutorial/source/tracing.rst index fe6ffb6ca..8ba188d48 100644 --- a/doc/tutorial/source/tracing.rst +++ b/doc/tutorial/source/tracing.rst @@ -1763,7 +1763,7 @@ creating simulation events. { m_running = false; - if (m_sendEvent.IsRunning()) + if (m_sendEvent.IsPending()) { Simulator::Cancel(m_sendEvent); } @@ -1776,7 +1776,7 @@ creating simulation events. Every time a simulation event is scheduled, an ``Event`` is created. If the ``Event`` is pending execution or executing, its method -``IsRunning`` will return ``true``. In this code, if ``IsRunning()`` +``IsPending`` will return ``true``. In this code, if ``IsPending()`` returns true, we ``Cancel`` the event which removes it from the simulator event queue. By doing this, we break the chain of events that the ``Application`` is using to keep sending its ``Packets`` and diff --git a/examples/tutorial/tutorial-app.cc b/examples/tutorial/tutorial-app.cc index 821cc0e9c..70568dec7 100644 --- a/examples/tutorial/tutorial-app.cc +++ b/examples/tutorial/tutorial-app.cc @@ -76,7 +76,7 @@ TutorialApp::StopApplication() { m_running = false; - if (m_sendEvent.IsRunning()) + if (m_sendEvent.IsPending()) { Simulator::Cancel(m_sendEvent); } diff --git a/src/applications/model/onoff-application.cc b/src/applications/model/onoff-application.cc index 7b1ad9064..a5f32c37f 100644 --- a/src/applications/model/onoff-application.cc +++ b/src/applications/model/onoff-application.cc @@ -268,7 +268,7 @@ OnOffApplication::CancelEvents() { NS_LOG_FUNCTION(this); - if (m_sendEvent.IsRunning() && m_cbrRateFailSafe == m_cbrRate) + if (m_sendEvent.IsPending() && m_cbrRateFailSafe == m_cbrRate) { // Cancel the pending send packet event // Calculate residual bits since last packet sent Time delta(Simulator::Now() - m_lastStartTime); diff --git a/src/core/model/event-id.cc b/src/core/model/event-id.cc index ef2dd46cd..174e01429 100644 --- a/src/core/model/event-id.cc +++ b/src/core/model/event-id.cc @@ -73,12 +73,18 @@ EventId::IsExpired() const } bool -EventId::IsRunning() const +EventId::IsPending() const { NS_LOG_FUNCTION(this); return !IsExpired(); } +bool +EventId::IsRunning() const +{ + return IsPending(); +} + EventImpl* EventId::PeekEventImpl() const { diff --git a/src/core/model/event-id.h b/src/core/model/event-id.h index 8361c6ec1..5f042d4d8 100644 --- a/src/core/model/event-id.h +++ b/src/core/model/event-id.h @@ -19,6 +19,7 @@ #ifndef EVENT_ID_H #define EVENT_ID_H +#include "deprecated.h" #include "event-impl.h" #include "ptr.h" @@ -47,7 +48,7 @@ class EventImpl; * The important thing to remember about this class is that * every variable of this type is _always_ in a valid state, * even when it has not been assigned an EventId coming from a - * Simulator::Schedule() method: calling Simulator::Cancel(), IsRunning(), + * Simulator::Schedule() method: calling Simulator::Cancel(), IsPending(), * IsExpired() or passing around instances of this object * will not result in crashes or memory leaks. */ @@ -101,6 +102,14 @@ class EventId * * \returns \c true if the event has not expired, \c false otherwise. */ + bool IsPending() const; + + /** + * This method is syntactic sugar for !IsExpired(). + * + * \returns \c true if the event has not expired, \c false otherwise. + */ + NS_DEPRECATED_3_42("Use IsPending instead") bool IsRunning() const; public: diff --git a/src/core/model/simulator.h b/src/core/model/simulator.h index 1e31d605a..326678304 100644 --- a/src/core/model/simulator.h +++ b/src/core/model/simulator.h @@ -426,7 +426,7 @@ class Simulator * Note that it is not possible to test for the expiration of * events which were scheduled for the "destroy" time. Doing so * will result in a program error (crash). - * An event is said to "expire" when it starts being scheduled + * An event is said to "expire" when it starts being executed, * which means that if the code executed by the event calls * this function, it will get true. * diff --git a/src/core/model/timer.cc b/src/core/model/timer.cc index 1fcba54c3..214125469 100644 --- a/src/core/model/timer.cc +++ b/src/core/model/timer.cc @@ -56,7 +56,7 @@ Timer::~Timer() NS_LOG_FUNCTION(this); if (m_flags & CHECK_ON_DESTROY) { - if (m_event.IsRunning()) + if (m_event.IsPending()) { NS_FATAL_ERROR("Event is still running while destroying."); } @@ -129,7 +129,7 @@ bool Timer::IsRunning() const { NS_LOG_FUNCTION(this); - return !IsSuspended() && m_event.IsRunning(); + return !IsSuspended() && m_event.IsPending(); } bool @@ -170,7 +170,7 @@ Timer::Schedule(Time delay) { NS_LOG_FUNCTION(this << delay); NS_ASSERT(m_impl != nullptr); - if (m_event.IsRunning()) + if (m_event.IsPending()) { NS_FATAL_ERROR("Event is still running while re-scheduling."); } diff --git a/src/core/model/trickle-timer.cc b/src/core/model/trickle-timer.cc index b9f8ec38e..524d1ac3c 100644 --- a/src/core/model/trickle-timer.cc +++ b/src/core/model/trickle-timer.cc @@ -132,7 +132,7 @@ TrickleTimer::GetDelayLeft() const { NS_LOG_FUNCTION(this); - if (m_timerExpiration.IsRunning()) + if (m_timerExpiration.IsPending()) { return Simulator::GetDelayLeft(m_timerExpiration); } @@ -145,7 +145,7 @@ TrickleTimer::GetIntervalLeft() const { NS_LOG_FUNCTION(this); - if (m_intervalExpiration.IsRunning()) + if (m_intervalExpiration.IsPending()) { return Simulator::GetDelayLeft(m_intervalExpiration); } diff --git a/src/core/model/unix-fd-reader.cc b/src/core/model/unix-fd-reader.cc index 89dd3801c..f73dc356b 100644 --- a/src/core/model/unix-fd-reader.cc +++ b/src/core/model/unix-fd-reader.cc @@ -93,7 +93,7 @@ FdReader::Start(int fd, Callback readCallback) // scheduling a "destroy time" method to make sure the thread exits before // proceeding. // - if (!m_destroyEvent.IsRunning()) + if (!m_destroyEvent.IsPending()) { // hold a reference to ensure that this object is not // deallocated before the destroy-time event fires diff --git a/src/core/model/watchdog.cc b/src/core/model/watchdog.cc index 18255e929..d98f101e0 100644 --- a/src/core/model/watchdog.cc +++ b/src/core/model/watchdog.cc @@ -52,7 +52,7 @@ Watchdog::Ping(Time delay) NS_LOG_FUNCTION(this << delay); Time end = Simulator::Now() + delay; m_end = std::max(m_end, end); - if (m_event.IsRunning()) + if (m_event.IsPending()) { return; } diff --git a/src/core/model/win32-fd-reader.cc b/src/core/model/win32-fd-reader.cc index c376bdaa7..06ab1f2e2 100644 --- a/src/core/model/win32-fd-reader.cc +++ b/src/core/model/win32-fd-reader.cc @@ -104,7 +104,7 @@ FdReader::Start(int fd, Callback readCallback) // scheduling a "destroy time" method to make sure the thread exits before // proceeding. // - if (!m_destroyEvent.IsRunning()) + if (!m_destroyEvent.IsPending()) { // hold a reference to ensure that this object is not // deallocated before the destroy-time event fires diff --git a/src/dsdv/model/dsdv-rtable.cc b/src/dsdv/model/dsdv-rtable.cc index 7f1f392a7..5e1a58e64 100644 --- a/src/dsdv/model/dsdv-rtable.cc +++ b/src/dsdv/model/dsdv-rtable.cc @@ -312,7 +312,7 @@ RoutingTable::AnyRunningEvent(Ipv4Address address) return false; } event = i->second; - return event.IsRunning(); + return event.IsPending(); } bool @@ -340,7 +340,7 @@ RoutingTable::DeleteIpv4Event(Ipv4Address address) return false; } event = i->second; - if (event.IsRunning()) + if (event.IsPending()) { return false; } diff --git a/src/internet-apps/model/ping.cc b/src/internet-apps/model/ping.cc index d7a9dbdbd..23a3c50c8 100644 --- a/src/internet-apps/model/ping.cc +++ b/src/internet-apps/model/ping.cc @@ -626,11 +626,11 @@ void Ping::StopApplication() { NS_LOG_FUNCTION(this); - if (m_stopEvent.IsRunning()) + if (m_stopEvent.IsPending()) { m_stopEvent.Cancel(); } - if (m_next.IsRunning()) + if (m_next.IsPending()) { m_next.Cancel(); } diff --git a/src/internet-apps/model/radvd.cc b/src/internet-apps/model/radvd.cc index b450ad8ab..2e62bdfac 100644 --- a/src/internet-apps/model/radvd.cc +++ b/src/internet-apps/model/radvd.cc @@ -369,7 +369,7 @@ Radvd::HandleRead(Ptr socket) if (m_solicitedEventIds.find((*it)->GetInterface()) != m_solicitedEventIds.end()) { - if (m_solicitedEventIds[(*it)->GetInterface()].IsRunning()) + if (m_solicitedEventIds[(*it)->GetInterface()].IsPending()) { scheduleSingle = false; } diff --git a/src/internet-apps/model/v4traceroute.cc b/src/internet-apps/model/v4traceroute.cc index b5d55c8bb..6cefc2194 100644 --- a/src/internet-apps/model/v4traceroute.cc +++ b/src/internet-apps/model/v4traceroute.cc @@ -162,12 +162,12 @@ V4TraceRoute::StopApplication() { NS_LOG_FUNCTION(this); - if (m_next.IsRunning()) + if (m_next.IsPending()) { m_next.Cancel(); } - if (m_waitIcmpReplyTimer.IsRunning()) + if (m_waitIcmpReplyTimer.IsPending()) { m_waitIcmpReplyTimer.Cancel(); } @@ -193,7 +193,7 @@ V4TraceRoute::DoDispose() { NS_LOG_FUNCTION(this); - if (m_next.IsRunning() || m_waitIcmpReplyTimer.IsRunning()) + if (m_next.IsPending() || m_waitIcmpReplyTimer.IsPending()) { StopApplication(); } @@ -422,7 +422,7 @@ void V4TraceRoute::StartWaitReplyTimer() { NS_LOG_FUNCTION(this); - if (!m_waitIcmpReplyTimer.IsRunning()) + if (!m_waitIcmpReplyTimer.IsPending()) { NS_LOG_LOGIC("Starting WaitIcmpReplyTimer at " << Simulator::Now() << " for " << m_waitIcmpReplyTimeout); diff --git a/src/internet/doc/tcp.rst b/src/internet/doc/tcp.rst index aabd67ff3..1de27d188 100644 --- a/src/internet/doc/tcp.rst +++ b/src/internet/doc/tcp.rst @@ -1986,7 +1986,7 @@ processing of the SYN-ACK: if (h.GetFlags() & TcpHeader::SYN) { EventId persistentEvent = GetPersistentEvent(SENDER); - NS_TEST_ASSERT_MSG_EQ(persistentEvent.IsRunning(), true, + NS_TEST_ASSERT_MSG_EQ(persistentEvent.IsPending(), true, "Persistent event not started"); } } diff --git a/src/internet/model/arp-cache.cc b/src/internet/model/arp-cache.cc index 1e2c7157b..4d48a8716 100644 --- a/src/internet/model/arp-cache.cc +++ b/src/internet/model/arp-cache.cc @@ -102,7 +102,7 @@ ArpCache::DoDispose() Flush(); m_device = nullptr; m_interface = nullptr; - if (!m_waitReplyTimer.IsRunning()) + if (!m_waitReplyTimer.IsPending()) { m_waitReplyTimer.Cancel(); } @@ -184,7 +184,7 @@ void ArpCache::StartWaitReplyTimer() { NS_LOG_FUNCTION(this); - if (!m_waitReplyTimer.IsRunning()) + if (!m_waitReplyTimer.IsPending()) { NS_LOG_LOGIC("Starting WaitReplyTimer at " << Simulator::Now() << " for " << m_waitReplyTimeout); @@ -250,7 +250,7 @@ ArpCache::Flush() delete (*i).second; } m_arpCache.erase(m_arpCache.begin(), m_arpCache.end()); - if (m_waitReplyTimer.IsRunning()) + if (m_waitReplyTimer.IsPending()) { NS_LOG_LOGIC("Stopping WaitReplyTimer at " << Simulator::Now().GetSeconds() << " due to ArpCache flush"); diff --git a/src/internet/model/icmpv6-l4-protocol.cc b/src/internet/model/icmpv6-l4-protocol.cc index 4f37f8c08..6d02650ed 100644 --- a/src/internet/model/icmpv6-l4-protocol.cc +++ b/src/internet/model/icmpv6-l4-protocol.cc @@ -421,7 +421,7 @@ Icmpv6L4Protocol::HandleRA(Ptr packet, { NS_LOG_FUNCTION(this << packet << src << dst << interface); - if (m_handleRsTimeoutEvent.IsRunning()) + if (m_handleRsTimeoutEvent.IsPending()) { m_handleRsTimeoutEvent.Cancel(); // We need to update this in case we need to restart RS retransmissions. diff --git a/src/internet/model/ipv4-l3-protocol.cc b/src/internet/model/ipv4-l3-protocol.cc index b113dd0d6..469086b17 100644 --- a/src/internet/model/ipv4-l3-protocol.cc +++ b/src/internet/model/ipv4-l3-protocol.cc @@ -333,12 +333,12 @@ Ipv4L3Protocol::DoDispose() m_fragments.clear(); m_timeoutEventList.clear(); - if (m_timeoutEvent.IsRunning()) + if (m_timeoutEvent.IsPending()) { m_timeoutEvent.Cancel(); } - if (m_cleanDpd.IsRunning()) + if (m_cleanDpd.IsPending()) { m_cleanDpd.Cancel(); } @@ -1800,7 +1800,7 @@ Ipv4L3Protocol::UpdateDuplicate(Ptr p, const Ipv4Header& header) } // set cleanup job for new duplicate entries - if (!m_cleanDpd.IsRunning() && m_purge.IsStrictlyPositive()) + if (!m_cleanDpd.IsPending() && m_purge.IsStrictlyPositive()) { m_cleanDpd = Simulator::Schedule(m_expire, &Ipv4L3Protocol::RemoveDuplicates, this); } diff --git a/src/internet/model/ipv6-extension.cc b/src/internet/model/ipv6-extension.cc index 9103f6773..8f66e5978 100644 --- a/src/internet/model/ipv6-extension.cc +++ b/src/internet/model/ipv6-extension.cc @@ -361,7 +361,7 @@ Ipv6ExtensionFragment::DoDispose() m_fragments.clear(); m_timeoutEventList.clear(); - if (m_timeoutEvent.IsRunning()) + if (m_timeoutEvent.IsPending()) { m_timeoutEvent.Cancel(); } diff --git a/src/internet/model/rip.cc b/src/internet/model/rip.cc index 9b6478024..acba6fdf6 100644 --- a/src/internet/model/rip.cc +++ b/src/internet/model/rip.cc @@ -741,7 +741,7 @@ Rip::InvalidateRoute(RipRoutingTableEntry* route) route->SetRouteStatus(RipRoutingTableEntry::RIP_INVALID); route->SetRouteMetric(m_linkDown); route->SetRouteChanged(true); - if (it->second.IsRunning()) + if (it->second.IsPending()) { it->second.Cancel(); } @@ -1275,7 +1275,7 @@ Rip::SendTriggeredRouteUpdate() { NS_LOG_FUNCTION(this); - if (m_nextTriggeredUpdate.IsRunning()) + if (m_nextTriggeredUpdate.IsPending()) { NS_LOG_LOGIC("Skipping Triggered Update due to cooldown"); return; @@ -1307,7 +1307,7 @@ Rip::SendUnsolicitedRouteUpdate() { NS_LOG_FUNCTION(this); - if (m_nextTriggeredUpdate.IsRunning()) + if (m_nextTriggeredUpdate.IsPending()) { m_nextTriggeredUpdate.Cancel(); } diff --git a/src/internet/model/ripng.cc b/src/internet/model/ripng.cc index 85304550d..45b10ef87 100644 --- a/src/internet/model/ripng.cc +++ b/src/internet/model/ripng.cc @@ -740,7 +740,7 @@ RipNg::InvalidateRoute(RipNgRoutingTableEntry* route) route->SetRouteStatus(RipNgRoutingTableEntry::RIPNG_INVALID); route->SetRouteMetric(m_linkDown); route->SetRouteChanged(true); - if (it->second.IsRunning()) + if (it->second.IsPending()) { it->second.Cancel(); } @@ -1276,7 +1276,7 @@ RipNg::SendTriggeredRouteUpdate() { NS_LOG_FUNCTION(this); - if (m_nextTriggeredUpdate.IsRunning()) + if (m_nextTriggeredUpdate.IsPending()) { NS_LOG_LOGIC("Skipping Triggered Update due to cooldown"); return; @@ -1308,7 +1308,7 @@ RipNg::SendUnsolicitedRouteUpdate() { NS_LOG_FUNCTION(this); - if (m_nextTriggeredUpdate.IsRunning()) + if (m_nextTriggeredUpdate.IsPending()) { m_nextTriggeredUpdate.Cancel(); } diff --git a/src/internet/model/tcp-socket-base.cc b/src/internet/model/tcp-socket-base.cc index b681c1204..11eb8742e 100644 --- a/src/internet/model/tcp-socket-base.cc +++ b/src/internet/model/tcp-socket-base.cc @@ -869,7 +869,7 @@ TcpSocketBase::Send(Ptr p, uint32_t flags) if ((m_state == ESTABLISHED || m_state == CLOSE_WAIT) && AvailableWindow() > 0) { // Try to send the data out: Add a little step to allow the application // to fill the buffer - if (!m_sendPendingDataEvent.IsRunning()) + if (!m_sendPendingDataEvent.IsPending()) { m_sendPendingDataEvent = Simulator::Schedule(TimeStep(1), &TcpSocketBase::SendPendingData, @@ -1136,7 +1136,7 @@ TcpSocketBase::CloseAndNotify() NotifyNormalClose(); m_closeNotified = true; } - if (m_lastAckEvent.IsRunning()) + if (m_lastAckEvent.IsPending()) { m_lastAckEvent.Cancel(); } @@ -1473,7 +1473,7 @@ TcpSocketBase::DoForwardUp(Ptr packet, const Address& fromAddress, const break; } - if (m_rWnd.Get() != 0 && m_persistEvent.IsRunning()) + if (m_rWnd.Get() != 0 && m_persistEvent.IsPending()) { // persist probes end, the other end has increased the window NS_ASSERT(m_connected); NS_LOG_LOGIC(this << " Leaving zerowindow persist state"); diff --git a/src/internet/test/tcp-cong-avoid-test.cc b/src/internet/test/tcp-cong-avoid-test.cc index e938f4c1f..3d2843ed9 100644 --- a/src/internet/test/tcp-cong-avoid-test.cc +++ b/src/internet/test/tcp-cong-avoid-test.cc @@ -132,7 +132,7 @@ TcpNewRenoCongAvoidNormalTest::CWndTrace(uint32_t oldValue, uint32_t newValue) return; } - if (!m_event.IsRunning()) + if (!m_event.IsPending()) { m_event = Simulator::Schedule(Seconds(1.0), &TcpNewRenoCongAvoidNormalTest::Check, this); } diff --git a/src/internet/test/tcp-zero-window-test.cc b/src/internet/test/tcp-zero-window-test.cc index 4b6ebf629..25a703a1a 100644 --- a/src/internet/test/tcp-zero-window-test.cc +++ b/src/internet/test/tcp-zero-window-test.cc @@ -236,7 +236,7 @@ TcpZeroWindowTest::ProcessedAck(const Ptr tcb, if (h.GetFlags() & TcpHeader::SYN) { EventId persistentEvent = GetPersistentEvent(SENDER); - NS_TEST_ASSERT_MSG_EQ(persistentEvent.IsRunning(), + NS_TEST_ASSERT_MSG_EQ(persistentEvent.IsPending(), true, "Persistent event not started"); } diff --git a/src/lr-wpan/model/lr-wpan-mac.cc b/src/lr-wpan/model/lr-wpan-mac.cc index 1ba5b025c..f5d6ff9f6 100644 --- a/src/lr-wpan/model/lr-wpan-mac.cc +++ b/src/lr-wpan/model/lr-wpan-mac.cc @@ -630,7 +630,7 @@ LrWpanMac::MlmeScanRequest(MlmeScanRequestParams params) confirmParams.m_scanType = params.m_scanType; confirmParams.m_chPage = params.m_chPage; - if ((m_scanEvent.IsRunning() || m_scanEnergyEvent.IsRunning()) || m_scanOrphanEvent.IsRunning()) + if ((m_scanEvent.IsPending() || m_scanEnergyEvent.IsPending()) || m_scanOrphanEvent.IsPending()) { if (!m_mlmeScanConfirmCallback.IsNull()) { @@ -879,7 +879,7 @@ LrWpanMac::MlmeSyncRequest(MlmeSyncRequestParams params) uint64_t searchSymbols; Time searchBeaconTime; - if (m_trackingEvent.IsRunning()) + if (m_trackingEvent.IsPending()) { m_trackingEvent.Cancel(); } @@ -1718,13 +1718,13 @@ LrWpanMac::CheckQueue() { NS_LOG_FUNCTION(this); // Pull a packet from the queue and start sending if we are not already sending. - if (m_macState == MAC_IDLE && !m_txQueue.empty() && !m_setMacState.IsRunning()) + if (m_macState == MAC_IDLE && !m_txQueue.empty() && !m_setMacState.IsPending()) { if (m_csmaCa->IsUnSlottedCsmaCa() || (m_outSuperframeStatus == CAP && m_coor) || m_incSuperframeStatus == CAP) { // check MAC is not in a IFS - if (!m_ifsEvent.IsRunning()) + if (!m_ifsEvent.IsPending()) { Ptr txQElement = m_txQueue.front(); m_txPkt = txQElement->txQPkt; @@ -1946,21 +1946,21 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr p, uint8_t lqi) acceptFrame = (receivedMacHdr.GetExtDstAddr() == m_macExtendedAddress); } - if (acceptFrame && m_scanEvent.IsRunning()) + if (acceptFrame && m_scanEvent.IsPending()) { if (!receivedMacHdr.IsBeacon()) { acceptFrame = false; } } - else if (acceptFrame && m_scanOrphanEvent.IsRunning()) + else if (acceptFrame && m_scanOrphanEvent.IsPending()) { if (!receivedMacHdr.IsCommand()) { acceptFrame = false; } } - else if (m_scanEnergyEvent.IsRunning()) + else if (m_scanEnergyEvent.IsPending()) { // Reject any frames if energy scan is running acceptFrame = false; @@ -1985,7 +1985,7 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr p, uint8_t lqi) // Although ACKs do not use CSMA to to be transmitted, we need to make sure // that the transmitted ACK will not collide with the transmission of a beacon // when beacon-enabled mode is running in the coordinator. - if (acceptFrame && (m_csmaCa->IsSlottedCsmaCa() && m_capEvent.IsRunning())) + if (acceptFrame && (m_csmaCa->IsSlottedCsmaCa() && m_capEvent.IsPending())) { Time timeLeftInCap = Simulator::GetDelayLeft(m_capEvent); uint64_t ackSymbols = lrwpan::aTurnaroundTime + m_phy->GetPhySHRDuration() + @@ -2123,7 +2123,7 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr p, uint8_t lqi) panDescriptor.m_timeStamp = m_macBeaconRxTime; // Process beacon when device belongs to a PAN (associated device) - if (!m_scanEvent.IsRunning() && m_macPanId == receivedMacHdr.GetDstPanId()) + if (!m_scanEvent.IsPending() && m_macPanId == receivedMacHdr.GetDstPanId()) { // We need to make sure to cancel any possible ongoing unslotted CSMA/CA // operations when receiving a beacon (e.g. Those taking place at the @@ -2178,7 +2178,7 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr p, uint8_t lqi) m_setMacState = Simulator::ScheduleNow(&LrWpanMac::SetLrWpanMacState, this, MAC_IDLE); } - else if (!m_scanEvent.IsRunning() && m_macPanId == 0xFFFF) + else if (!m_scanEvent.IsPending() && m_macPanId == 0xFFFF) { NS_LOG_DEBUG(this << " Device not associated, cannot process beacon"); } @@ -2199,7 +2199,7 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr p, uint8_t lqi) } } - if (m_scanEvent.IsRunning()) + if (m_scanEvent.IsPending()) { // Channel scanning is taking place, save only unique PAN descriptors bool descriptorExists = false; @@ -2236,7 +2236,7 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr p, uint8_t lqi) } return; } - else if (m_trackingEvent.IsRunning()) + else if (m_trackingEvent.IsPending()) { // check if MLME-SYNC.request was previously issued and running // Sync. is necessary to handle pending messages (indirect @@ -2318,7 +2318,7 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr p, uint8_t lqi) } break; case CommandPayloadHeader::COOR_REALIGN: - if (m_scanOrphanEvent.IsRunning()) + if (m_scanOrphanEvent.IsPending()) { // Coordinator located, no need to keep scanning other channels m_scanOrphanEvent.Cancel(); @@ -3298,7 +3298,7 @@ LrWpanMac::PlmeSetTRXStateConfirm(PhyEnumeration status) NS_ASSERT(status == IEEE_802_15_4_PHY_RX_ON || status == IEEE_802_15_4_PHY_SUCCESS || status == IEEE_802_15_4_PHY_TRX_OFF); - if (status == IEEE_802_15_4_PHY_RX_ON && m_scanEnergyEvent.IsRunning()) + if (status == IEEE_802_15_4_PHY_RX_ON && m_scanEnergyEvent.IsPending()) { // Kick start Energy Detection Scan m_phy->PlmeEdRequest(); @@ -3651,7 +3651,7 @@ LrWpanMac::SetLrWpanMacState(MacState macState) break; } case CommandPayloadHeader::ORPHAN_NOTIF: { - if (m_scanOrphanEvent.IsRunning()) + if (m_scanOrphanEvent.IsPending()) { m_unscannedChannels.emplace_back(m_phy->GetCurrentChannelNum()); } @@ -3660,7 +3660,7 @@ LrWpanMac::SetLrWpanMacState(MacState macState) break; } case CommandPayloadHeader::BEACON_REQ: { - if (m_scanEvent.IsRunning()) + if (m_scanEvent.IsPending()) { m_unscannedChannels.emplace_back(m_phy->GetCurrentChannelNum()); } diff --git a/src/lr-wpan/model/lr-wpan-phy.cc b/src/lr-wpan/model/lr-wpan-phy.cc index 782263514..058c4fa2e 100644 --- a/src/lr-wpan/model/lr-wpan-phy.cc +++ b/src/lr-wpan/model/lr-wpan-phy.cc @@ -403,7 +403,7 @@ LrWpanPhy::StartRx(Ptr spectrumRxParams) NS_ASSERT(p); // Prevent PHY from receiving another packet while switching the transceiver state. - if (m_trxState == IEEE_802_15_4_PHY_RX_ON && !m_setTRXState.IsRunning()) + if (m_trxState == IEEE_802_15_4_PHY_RX_ON && !m_setTRXState.IsPending()) { // The specification doesn't seem to refer to BUSY_RX, but vendor // data sheets suggest that this is a substate of the RX_ON state @@ -646,7 +646,7 @@ LrWpanPhy::PdDataRequest(const uint32_t psduLength, Ptr p) } // Prevent PHY from sending a packet while switching the transceiver state. - if (!m_setTRXState.IsRunning()) + if (!m_setTRXState.IsPending()) { if (m_trxState == IEEE_802_15_4_PHY_TX_ON) { @@ -1547,7 +1547,7 @@ LrWpanPhy::EndTx() { // Only change the state immediately, if the transceiver is not already // switching the state. - if (!m_setTRXState.IsRunning()) + if (!m_setTRXState.IsPending()) { NS_LOG_LOGIC("Apply pending state change to " << m_trxStatePending); ChangeTrxState(m_trxStatePending); diff --git a/src/lte/model/lte-rlc-am.cc b/src/lte/model/lte-rlc-am.cc index 03c190e7a..bfa0ad6bd 100644 --- a/src/lte/model/lte-rlc-am.cc +++ b/src/lte/model/lte-rlc-am.cc @@ -212,7 +212,7 @@ LteRlcAm::DoNotifyTxOpportunity(LteMacSapUser::TxOpportunityParameters txOpParam return; } - if (m_statusPduRequested && !m_statusProhibitTimer.IsRunning()) + if (m_statusPduRequested && !m_statusProhibitTimer.IsPending()) { if (txOpParams.bytes < m_statusPduBufferSize) { @@ -340,7 +340,7 @@ LteRlcAm::DoNotifyTxOpportunity(LteMacSapUser::TxOpportunityParameters txOpParam m_pollSn = m_vtS - 1; NS_LOG_LOGIC("New POLL_SN = " << m_pollSn); - if (!m_pollRetransmitTimer.IsRunning()) + if (!m_pollRetransmitTimer.IsPending()) { NS_LOG_LOGIC("Start PollRetransmit timer"); @@ -728,7 +728,7 @@ LteRlcAm::DoNotifyTxOpportunity(LteMacSapUser::TxOpportunityParameters txOpParam m_pollSn = m_vtS - 1; NS_LOG_LOGIC("New POLL_SN = " << m_pollSn); - if (!m_pollRetransmitTimer.IsRunning()) + if (!m_pollRetransmitTimer.IsPending()) { NS_LOG_LOGIC("Start PollRetransmit timer"); @@ -884,7 +884,7 @@ LteRlcAm::DoReceivePdu(LteMacSapUser::ReceivePduParameters rxPduParams) m_statusPduRequested = true; m_statusPduBufferSize = 4; - if (!m_statusProhibitTimer.IsRunning()) + if (!m_statusProhibitTimer.IsPending()) { DoReportBufferStatus(); } @@ -1018,7 +1018,7 @@ LteRlcAm::DoReceivePdu(LteMacSapUser::ReceivePduParameters rxPduParams) // - if VR(X) falls outside of the receiving window and VR(X) is not equal to VR(MR): // - stop and reset t-Reordering; - if (m_reorderingTimer.IsRunning()) + if (m_reorderingTimer.IsPending()) { NS_LOG_LOGIC("Reordering timer is running"); if ((m_vrX == m_vrR) || ((!IsInsideReceivingWindow(m_vrX)) && (m_vrX != m_vrMr))) @@ -1035,7 +1035,7 @@ LteRlcAm::DoReceivePdu(LteMacSapUser::ReceivePduParameters rxPduParams) // - start t-Reordering; // - set VR(X) to VR(H). - if (!m_reorderingTimer.IsRunning()) + if (!m_reorderingTimer.IsPending()) { NS_LOG_LOGIC("Reordering timer is not running"); if (m_vrH > m_vrR) @@ -1076,7 +1076,7 @@ LteRlcAm::DoReceivePdu(LteMacSapUser::ReceivePduParameters rxPduParams) uint16_t seqNumberValue = sn.GetValue(); - if (m_pollRetransmitTimer.IsRunning() && (seqNumberValue == m_pollSn.GetValue())) + if (m_pollRetransmitTimer.IsPending() && (seqNumberValue == m_pollSn.GetValue())) { m_pollRetransmitTimer.Cancel(); } @@ -1665,7 +1665,7 @@ LteRlcAm::DoReportBufferStatus() r.retxQueueSize = m_retxBufferSize + m_txedBufferSize; r.retxQueueHolDelay = retxQueueHolDelay.GetMilliSeconds(); - if (m_statusPduRequested && !m_statusProhibitTimer.IsRunning()) + if (m_statusPduRequested && !m_statusProhibitTimer.IsPending()) { r.statusPduSize = m_statusPduBufferSize; } diff --git a/src/lte/model/lte-rlc-um.cc b/src/lte/model/lte-rlc-um.cc index 9e02a8628..c49dc0a3c 100644 --- a/src/lte/model/lte-rlc-um.cc +++ b/src/lte/model/lte-rlc-um.cc @@ -584,7 +584,7 @@ LteRlcUm::DoReceivePdu(LteMacSapUser::ReceivePduParameters rxPduParams) // - if VR(UX) <= VR(UR); or // - if VR(UX) falls outside of the reordering window and VR(UX) is not equal to VR(UH):: // - stop and reset t-Reordering; - if (m_reorderingTimer.IsRunning()) + if (m_reorderingTimer.IsPending()) { NS_LOG_LOGIC("Reordering timer is running"); @@ -600,7 +600,7 @@ LteRlcUm::DoReceivePdu(LteMacSapUser::ReceivePduParameters rxPduParams) // - if VR(UH) > VR(UR): // - start t-Reordering; // - set VR(UX) to VR(UH). - if (!m_reorderingTimer.IsRunning()) + if (!m_reorderingTimer.IsPending()) { NS_LOG_LOGIC("Reordering timer is not running"); diff --git a/src/lte/model/lte-ue-rrc.cc b/src/lte/model/lte-ue-rrc.cc index e61290721..d8759b07e 100644 --- a/src/lte/model/lte-ue-rrc.cc +++ b/src/lte/model/lte-ue-rrc.cc @@ -1061,7 +1061,7 @@ LteUeRrc::DoRecvRrcConnectionReconfiguration(LteRrcSap::RrcConnectionReconfigura { NS_LOG_INFO("haveMobilityControlInfo == true"); SwitchToState(CONNECTED_HANDOVER); - if (m_radioLinkFailureDetected.IsRunning()) + if (m_radioLinkFailureDetected.IsPending()) { ResetRlfParams(); } @@ -2814,7 +2814,7 @@ LteUeRrc::VarMeasReportListAdd(uint8_t measId, ConcernedCells_t enteringCells) NS_ASSERT(!measReportIt->second.cellsTriggeredList.empty()); // #issue 224, schedule only when there is no periodic event scheduled already - if (!measReportIt->second.periodicReportTimer.IsRunning()) + if (!measReportIt->second.periodicReportTimer.IsPending()) { measReportIt->second.numberOfReportsSent = 0; measReportIt->second.periodicReportTimer = @@ -3312,7 +3312,7 @@ LteUeRrc::DoNotifyOutOfSync() { m_radioLinkFailureDetected = Simulator::Schedule(m_t310, &LteUeRrc::RadioLinkFailureDetected, this); - if (m_radioLinkFailureDetected.IsRunning()) + if (m_radioLinkFailureDetected.IsPending()) { NS_LOG_INFO("t310 started"); } diff --git a/src/mesh/model/dot11s/hwmp-protocol-mac.cc b/src/mesh/model/dot11s/hwmp-protocol-mac.cc index 3234e3085..b72a5e4cf 100644 --- a/src/mesh/model/dot11s/hwmp-protocol-mac.cc +++ b/src/mesh/model/dot11s/hwmp-protocol-mac.cc @@ -321,7 +321,7 @@ void HwmpProtocolMac::SendMyPreq() { NS_LOG_FUNCTION(this); - if (m_preqTimer.IsRunning()) + if (m_preqTimer.IsPending()) { return; } @@ -330,7 +330,7 @@ HwmpProtocolMac::SendMyPreq() return; } // reschedule sending PREQ - NS_ASSERT(!m_preqTimer.IsRunning()); + NS_ASSERT(!m_preqTimer.IsPending()); m_preqTimer = Simulator::Schedule(m_protocol->GetPreqMinInterval(), &HwmpProtocolMac::SendMyPreq, this); SendPreqVector(m_myPreq); @@ -466,7 +466,7 @@ void HwmpProtocolMac::SendMyPerr() { NS_LOG_FUNCTION(this); - if (m_perrTimer.IsRunning()) + if (m_perrTimer.IsPending()) { return; } diff --git a/src/mesh/model/mesh-wifi-interface-mac.cc b/src/mesh/model/mesh-wifi-interface-mac.cc index 1d4049c8f..1ff9e94e3 100644 --- a/src/mesh/model/mesh-wifi-interface-mac.cc +++ b/src/mesh/model/mesh-wifi-interface-mac.cc @@ -149,7 +149,7 @@ MeshWifiInterfaceMac::DoInitialize() { Time randomStart = Seconds(m_coefficient->GetValue()); // Now start sending beacons after some random delay (to avoid collisions) - NS_ASSERT(!m_beaconSendEvent.IsRunning()); + NS_ASSERT(!m_beaconSendEvent.IsPending()); m_beaconSendEvent = Simulator::Schedule(randomStart, &MeshWifiInterfaceMac::SendBeacon, this); m_tbtt = Simulator::Now() + randomStart; @@ -387,7 +387,7 @@ MeshWifiInterfaceMac::SetBeaconGeneration(bool enable) bool MeshWifiInterfaceMac::GetBeaconGeneration() const { - return m_beaconSendEvent.IsRunning(); + return m_beaconSendEvent.IsPending(); } Time @@ -423,7 +423,7 @@ MeshWifiInterfaceMac::SendBeacon() NS_LOG_FUNCTION(this); NS_LOG_DEBUG(GetAddress() << " is sending beacon"); - NS_ASSERT(!m_beaconSendEvent.IsRunning()); + NS_ASSERT(!m_beaconSendEvent.IsPending()); // Form & send beacon MeshWifiBeacon beacon(GetSsid(), GetSupportedRates(), m_beaconInterval.GetMicroSeconds()); diff --git a/src/mobility/model/steady-state-random-waypoint-mobility-model.cc b/src/mobility/model/steady-state-random-waypoint-mobility-model.cc index 0af855134..668e3396c 100644 --- a/src/mobility/model/steady-state-random-waypoint-mobility-model.cc +++ b/src/mobility/model/steady-state-random-waypoint-mobility-model.cc @@ -183,7 +183,7 @@ SteadyStateRandomWaypointMobilityModel::DoInitializePrivate() { pause = Seconds(u * expectedPauseTime); } - NS_ASSERT(!m_event.IsRunning()); + NS_ASSERT(!m_event.IsPending()); m_event = Simulator::Schedule(pause, &SteadyStateRandomWaypointMobilityModel::BeginWalk, this); } @@ -209,7 +209,7 @@ SteadyStateRandomWaypointMobilityModel::DoInitializePrivate() double u2 = m_u_r->GetValue(0, 1); m_helper.SetPosition( Vector(m_minX + u2 * x1 + (1 - u2) * x2, m_minY + u2 * y1 + (1 - u2) * y2, m_z)); - NS_ASSERT(!m_event.IsRunning()); + NS_ASSERT(!m_event.IsPending()); m_event = Simulator::ScheduleNow(&SteadyStateRandomWaypointMobilityModel::SteadyStateBeginWalk, this, diff --git a/src/network/utils/simple-net-device.cc b/src/network/utils/simple-net-device.cc index 8394b062f..af6b75b49 100644 --- a/src/network/utils/simple-net-device.cc +++ b/src/network/utils/simple-net-device.cc @@ -450,7 +450,7 @@ SimpleNetDevice::SendFrom(Ptr p, if (m_queue->Enqueue(p)) { - if (m_queue->GetNPackets() == 1 && !FinishTransmissionEvent.IsRunning()) + if (m_queue->GetNPackets() == 1 && !FinishTransmissionEvent.IsPending()) { StartTransmission(); } @@ -467,7 +467,7 @@ SimpleNetDevice::StartTransmission() { return; } - NS_ASSERT_MSG(!FinishTransmissionEvent.IsRunning(), + NS_ASSERT_MSG(!FinishTransmissionEvent.IsPending(), "Tried to transmit a packet while another transmission was in progress"); Ptr packet = m_queue->Dequeue(); @@ -544,7 +544,7 @@ SimpleNetDevice::DoDispose() m_node = nullptr; m_receiveErrorModel = nullptr; m_queue->Dispose(); - if (FinishTransmissionEvent.IsRunning()) + if (FinishTransmissionEvent.IsPending()) { FinishTransmissionEvent.Cancel(); } diff --git a/src/sixlowpan/model/sixlowpan-net-device.cc b/src/sixlowpan/model/sixlowpan-net-device.cc index a9eef7a79..056809d63 100644 --- a/src/sixlowpan/model/sixlowpan-net-device.cc +++ b/src/sixlowpan/model/sixlowpan-net-device.cc @@ -180,7 +180,7 @@ SixLowPanNetDevice::DoDispose() m_node = nullptr; m_timeoutEventList.clear(); - if (m_timeoutEvent.IsRunning()) + if (m_timeoutEvent.IsPending()) { m_timeoutEvent.Cancel(); } diff --git a/src/spectrum/model/waveform-generator.cc b/src/spectrum/model/waveform-generator.cc index 0d9825e00..47a4b48d1 100644 --- a/src/spectrum/model/waveform-generator.cc +++ b/src/spectrum/model/waveform-generator.cc @@ -53,7 +53,7 @@ WaveformGenerator::DoDispose() m_channel = nullptr; m_netDevice = nullptr; m_mobility = nullptr; - if (m_nextWave.IsRunning()) + if (m_nextWave.IsPending()) { m_nextWave.Cancel(); } @@ -202,7 +202,7 @@ void WaveformGenerator::Start() { NS_LOG_FUNCTION(this); - if (!m_nextWave.IsRunning()) + if (!m_nextWave.IsPending()) { NS_LOG_LOGIC("generator was not active, now starting"); m_startTime = Now(); @@ -214,7 +214,7 @@ void WaveformGenerator::Stop() { NS_LOG_FUNCTION(this); - if (m_nextWave.IsRunning()) + if (m_nextWave.IsPending()) { m_nextWave.Cancel(); } diff --git a/src/uan/model/uan-mac-rc.cc b/src/uan/model/uan-mac-rc.cc index 5714d0026..58160b5b7 100644 --- a/src/uan/model/uan-mac-rc.cc +++ b/src/uan/model/uan-mac-rc.cc @@ -294,7 +294,7 @@ UanMacRc::Enqueue(Ptr packet, uint16_t protocolNumber, const Address& de Associate(); return true; case IDLE: - if (!m_rtsEvent.IsRunning()) + if (!m_rtsEvent.IsPending()) { SendRts(); } @@ -489,7 +489,7 @@ UanMacRc::ScheduleData(const UanHeaderRcCts& ctsh, m_state = IDLE; if (!m_pktQueue.empty()) { - if (m_rtsEvent.IsRunning()) + if (m_rtsEvent.IsPending()) { m_rtsEvent.Cancel(); } @@ -625,7 +625,7 @@ UanMacRc::Associate() SendPacket(pkt, m_currentRate + m_numRates); } m_state = GWPSENT; - NS_ASSERT(!m_rtsEvent.IsRunning()); + NS_ASSERT(!m_rtsEvent.IsPending()); m_ev->SetAttribute("Mean", DoubleValue(1 / m_retryRate)); double timeout = m_ev->GetValue(); m_rtsEvent = Simulator::Schedule(Seconds(timeout), &UanMacRc::AssociateTimeout, this); @@ -659,7 +659,7 @@ UanMacRc::AssociateTimeout() SendPacket(pkt, m_currentRate + m_numRates); m_resList.push_back(res); } - NS_ASSERT(!m_rtsEvent.IsRunning()); + NS_ASSERT(!m_rtsEvent.IsPending()); m_ev->SetAttribute("Mean", DoubleValue(1 / m_retryRate)); double timeout = m_ev->GetValue(); m_rtsEvent = Simulator::Schedule(Seconds(timeout), &UanMacRc::AssociateTimeout, this); @@ -693,7 +693,7 @@ UanMacRc::SendRts() SendPacket(pkt, m_currentRate + m_numRates); } m_state = RTSSENT; - NS_ASSERT(!m_rtsEvent.IsRunning()); + NS_ASSERT(!m_rtsEvent.IsPending()); m_ev->SetAttribute("Mean", DoubleValue(1 / m_retryRate)); double timeout = m_ev->GetValue(); m_rtsEvent = Simulator::Schedule(Seconds(timeout), &UanMacRc::RtsTimeout, this); @@ -755,7 +755,7 @@ UanMacRc::RtsTimeout() SendPacket(pkt, m_currentRate + m_numRates); } m_state = RTSSENT; - NS_ASSERT(!m_rtsEvent.IsRunning()); + NS_ASSERT(!m_rtsEvent.IsPending()); m_ev->SetAttribute("Mean", DoubleValue(1 / m_retryRate)); double timeout = m_ev->GetValue(); m_rtsEvent = Simulator::Schedule(Seconds(timeout), &UanMacRc::RtsTimeout, this); diff --git a/src/uan/model/uan-phy-gen.cc b/src/uan/model/uan-phy-gen.cc index 257a4f5a2..8a26806fe 100644 --- a/src/uan/model/uan-phy-gen.cc +++ b/src/uan/model/uan-phy-gen.cc @@ -656,13 +656,13 @@ UanPhyGen::EnergyDepletionHandler() << ", stopping rx/tx activities"); m_state = DISABLED; - if (m_txEndEvent.IsRunning()) + if (m_txEndEvent.IsPending()) { Simulator::Cancel(m_txEndEvent); NotifyTxDrop(m_pktTx); m_pktTx = nullptr; } - if (m_rxEndEvent.IsRunning()) + if (m_rxEndEvent.IsPending()) { Simulator::Cancel(m_rxEndEvent); NotifyRxDrop(m_pktRx); diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index e57a69f65..5954a5cbb 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -1749,7 +1749,7 @@ ApWifiMac::TxOk(Ptr mpdu) // we can stop the timer and enforce the configuration deriving from the // EML Notification frame sent by the EMLSR client if (auto eventIt = m_transitionTimeoutEvents.find(hdr.GetAddr1()); - eventIt != m_transitionTimeoutEvents.cend() && eventIt->second.IsRunning()) + eventIt != m_transitionTimeoutEvents.cend() && eventIt->second.IsPending()) { // no need to wait until the expiration of the transition timeout eventIt->second.PeekEventImpl()->Invoke(); diff --git a/src/wifi/model/block-ack-manager.cc b/src/wifi/model/block-ack-manager.cc index 49cb83918..bc02ffb9b 100644 --- a/src/wifi/model/block-ack-manager.cc +++ b/src/wifi/model/block-ack-manager.cc @@ -450,7 +450,7 @@ BlockAckManager::NotifyGotBlockAck(uint8_t linkId, uint16_t nSuccessfulMpdus = 0; uint16_t nFailedMpdus = 0; - if (it->second.first.m_inactivityEvent.IsRunning()) + if (it->second.first.m_inactivityEvent.IsPending()) { /* Upon reception of a BlockAck frame, the inactivity timer at the originator must be reset. diff --git a/src/wifi/model/channel-access-manager.cc b/src/wifi/model/channel-access-manager.cc index 5a2716fdc..73967797f 100644 --- a/src/wifi/model/channel-access-manager.cc +++ b/src/wifi/model/channel-access-manager.cc @@ -733,7 +733,7 @@ ChannelAccessManager::DoRestartAccessTimeoutIfNeeded() { NS_LOG_DEBUG("expected backoff end=" << expectedBackoffEnd); Time expectedBackoffDelay = expectedBackoffEnd - Simulator::Now(); - if (m_accessTimeout.IsRunning() && + if (m_accessTimeout.IsPending() && Simulator::GetDelayLeft(m_accessTimeout) > expectedBackoffDelay) { m_accessTimeout.Cancel(); @@ -976,7 +976,7 @@ ChannelAccessManager::ResetState() InitLastBusyStructs(); // Cancel timeout - if (m_accessTimeout.IsRunning()) + if (m_accessTimeout.IsPending()) { m_accessTimeout.Cancel(); } @@ -1015,7 +1015,7 @@ ChannelAccessManager::NotifySleepNow() NS_LOG_FUNCTION(this); m_sleeping = true; // Cancel timeout - if (m_accessTimeout.IsRunning()) + if (m_accessTimeout.IsPending()) { m_accessTimeout.Cancel(); } @@ -1033,7 +1033,7 @@ ChannelAccessManager::NotifyOffNow() NS_LOG_FUNCTION(this); m_off = true; // Cancel timeout - if (m_accessTimeout.IsRunning()) + if (m_accessTimeout.IsPending()) { m_accessTimeout.Cancel(); } diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.cc b/src/wifi/model/eht/eht-frame-exchange-manager.cc index 5ffe3f790..abce2538a 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.cc +++ b/src/wifi/model/eht/eht-frame-exchange-manager.cc @@ -192,7 +192,7 @@ EhtFrameExchangeManager::StartTransmission(Ptr edca, uint16_t allowedWidth // check if an EMLSR client is the holder of an UL TXOP on the other link if (auto ehtFem = StaticCast(m_mac->GetFrameExchangeManager(linkId)); - ehtFem->m_ongoingTxopEnd.IsRunning() && ehtFem->m_txopHolder && + ehtFem->m_ongoingTxopEnd.IsPending() && ehtFem->m_txopHolder && m_mac->GetWifiRemoteStationManager(linkId)->GetEmlsrEnabled( ehtFem->m_txopHolder.value())) { @@ -473,7 +473,7 @@ EhtFrameExchangeManager::EmlsrSwitchToListening(const Mac48Address& address, con { if (auto ehtFem = StaticCast(m_mac->GetFrameExchangeManager(linkId)); - ehtFem->m_ongoingTxopEnd.IsRunning() && ehtFem->m_txopHolder && + ehtFem->m_ongoingTxopEnd.IsPending() && ehtFem->m_txopHolder && m_mac->GetWifiRemoteStationManager(linkId)->GetMldAddress(*ehtFem->m_txopHolder) == mldAddress) { @@ -705,7 +705,7 @@ EhtFrameExchangeManager::CtsAfterMuRtsTimeout(Ptr muRts, const WifiTxV auto mldAddress = GetWifiRemoteStationManager()->GetMldAddress(address); NS_ASSERT(mldAddress); - if (m_ongoingTxopEnd.IsRunning() && m_txopHolder && + if (m_ongoingTxopEnd.IsPending() && m_txopHolder && m_mac->GetMldAddress(*m_txopHolder) == mldAddress) { continue; @@ -897,7 +897,7 @@ EhtFrameExchangeManager::NotifyChannelReleased(Ptr txop) NS_ASSERT(m_staMac->GetEmlsrManager()); m_staMac->GetEmlsrManager()->NotifyTxopEnd(m_linkId, (!txopStart || *txopStart == Simulator::Now()), - m_ongoingTxopEnd.IsRunning()); + m_ongoingTxopEnd.IsPending()); } HeFrameExchangeManager::NotifyChannelReleased(txop); @@ -962,7 +962,7 @@ EhtFrameExchangeManager::PostProcessFrame(Ptr psdu, const WifiTx if (m_apMac && m_txopHolder == psdu->GetAddr2() && GetWifiRemoteStationManager()->GetEmlsrEnabled(*m_txopHolder)) { - if (!m_ongoingTxopEnd.IsRunning()) + if (!m_ongoingTxopEnd.IsPending()) { // an EMLSR client has started an UL TXOP. Start the ongoingTxopEnd timer so that // the next call to UpdateTxopEndOnRxEnd does its job @@ -973,7 +973,7 @@ EhtFrameExchangeManager::PostProcessFrame(Ptr psdu, const WifiTx UpdateTxopEndOnRxEnd(psdu->GetDuration()); } - if (m_staMac && m_ongoingTxopEnd.IsRunning()) + if (m_staMac && m_ongoingTxopEnd.IsPending()) { if (GetEmlsrSwitchToListening(psdu, m_staMac->GetAssociationId(), m_self)) { @@ -996,7 +996,7 @@ EhtFrameExchangeManager::CheckEmlsrClientStartingTxop(const WifiMacHeader& hdr, auto sender = hdr.GetAddr2(); - if (m_ongoingTxopEnd.IsRunning()) + if (m_ongoingTxopEnd.IsPending()) { NS_LOG_DEBUG("A TXOP is already ongoing"); return false; @@ -1041,7 +1041,7 @@ EhtFrameExchangeManager::CheckEmlsrClientStartingTxop(const WifiMacHeader& hdr, // Stop the transition delay timer for this EMLSR client, if any is running if (auto it = m_transDelayTimer.find(*mldAddress); - it != m_transDelayTimer.end() && it->second.IsRunning()) + it != m_transDelayTimer.end() && it->second.IsPending()) { it->second.PeekEventImpl()->Invoke(); it->second.Cancel(); @@ -1209,7 +1209,7 @@ EhtFrameExchangeManager::UpdateTxopEndOnTxStart(Time txDuration, Time durationId { NS_LOG_FUNCTION(this << txDuration.As(Time::MS) << durationId.As(Time::US)); - if (!m_ongoingTxopEnd.IsRunning()) + if (!m_ongoingTxopEnd.IsPending()) { // nothing to do return; @@ -1252,7 +1252,7 @@ EhtFrameExchangeManager::UpdateTxopEndOnRxStartIndication(Time psduDuration) { NS_LOG_FUNCTION(this << psduDuration.As(Time::MS)); - if (!m_ongoingTxopEnd.IsRunning() || !psduDuration.IsStrictlyPositive()) + if (!m_ongoingTxopEnd.IsPending() || !psduDuration.IsStrictlyPositive()) { // nothing to do return; @@ -1273,7 +1273,7 @@ EhtFrameExchangeManager::UpdateTxopEndOnRxEnd(Time durationId) { NS_LOG_FUNCTION(this << durationId.As(Time::US)); - if (!m_ongoingTxopEnd.IsRunning()) + if (!m_ongoingTxopEnd.IsPending()) { // nothing to do return; diff --git a/src/wifi/model/eht/emlsr-manager.cc b/src/wifi/model/eht/emlsr-manager.cc index efb16cee1..08d1005be 100644 --- a/src/wifi/model/eht/emlsr-manager.cc +++ b/src/wifi/model/eht/emlsr-manager.cc @@ -231,7 +231,7 @@ std::optional