wifi: No need for scheduling SwitchToSleep() after 728f4651

This commit is contained in:
Stefano Avallone
2024-07-01 17:31:06 +02:00
parent d57753a184
commit 31a6342b24

View File

@@ -1426,13 +1426,7 @@ WifiPhy::SetSleepMode()
// The PHY object may be in CCA_BUSY state because it is receiving a preamble. Cancel
// preamble events before switching to sleep state
Reset();
// It may happen that we request to switch to sleep at the same time the reception of
// a PPDU ends. In such a case, WifiPhyStateHelper::GetState() does not return RX
// (m_endRx equals now), we get here and set the state to SLEEP. However,
// WifiPhyStateHelper::DoSwitchFromRx() may be called after this function (at the same
// simulation time), thus hitting the assert that checks that the state is IDLE or
// CCA_BUSY.
Simulator::ScheduleNow(&WifiPhyStateHelper::SwitchToSleep, m_state);
m_state->SwitchToSleep();
break;
case WifiPhyState::SLEEP:
NS_LOG_DEBUG("already in sleep mode");