diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.cc b/src/wifi/model/eht/eht-frame-exchange-manager.cc index 3bbdb7446..539709e81 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.cc +++ b/src/wifi/model/eht/eht-frame-exchange-manager.cc @@ -179,13 +179,11 @@ EhtFrameExchangeManager::StartTransmission(Ptr edca, uint16_t allowedWidth edca->NotifyChannelReleased(m_linkId); NS_LOG_DEBUG("No new TXOP attempts allowed while MediumSyncDelay is running"); // request channel access if needed when the MediumSyncDelay timer expires - Simulator::Schedule(emlsrManager->GetMediumSyncDuration() - *elapsed, [=, this]() { - if (edca->GetAccessStatus(m_linkId) == Txop::NOT_REQUESTED && - edca->HasFramesToTransmit(m_linkId)) - { - m_staMac->GetChannelAccessManager(m_linkId)->RequestAccess(edca); - } - }); + Simulator::Schedule(emlsrManager->GetMediumSyncDuration() - *elapsed, + &Txop::StartAccessIfNeeded, + edca, + m_linkId); + return false; } diff --git a/src/wifi/model/txop.h b/src/wifi/model/txop.h index a496aa0a8..189d2d545 100644 --- a/src/wifi/model/txop.h +++ b/src/wifi/model/txop.h @@ -395,6 +395,13 @@ class Txop : public Object */ virtual ChannelAccessStatus GetAccessStatus(uint8_t linkId) const; + /** + * Request access from Txop on the given link if needed. + * + * \param linkId the ID of the given link + */ + void StartAccessIfNeeded(uint8_t linkId); + /** * \param nSlots the number of slots of the backoff. * \param linkId the ID of the given link @@ -443,12 +450,6 @@ class Txop : public Object * \param linkId the ID of the given link */ virtual void GenerateBackoff(uint8_t linkId); - /** - * Request access from Txop on the given link if needed. - * - * \param linkId the ID of the given link - */ - virtual void StartAccessIfNeeded(uint8_t linkId); /** * Request access to the ChannelAccessManager associated with the given link * diff --git a/src/wifi/model/wifi-mac.cc b/src/wifi/model/wifi-mac.cc index eda487d97..f5d6e8b87 100644 --- a/src/wifi/model/wifi-mac.cc +++ b/src/wifi/model/wifi-mac.cc @@ -1465,14 +1465,7 @@ WifiMac::UnblockUnicastTxOnLinks(WifiQueueBlockedReason reason, {linkId}); // request channel access if needed (schedule now because multiple invocations // of this method may be done in a loop at the caller) - auto qosTxop = GetQosTxop(acIndex); - Simulator::ScheduleNow([=, this]() { - if (qosTxop->GetAccessStatus(linkId) == Txop::NOT_REQUESTED && - qosTxop->HasFramesToTransmit(linkId)) - { - GetLink(linkId).channelAccessManager->RequestAccess(qosTxop); - } - }); + Simulator::ScheduleNow(&Txop::StartAccessIfNeeded, GetQosTxop(acIndex), linkId); } } }