From 74c973cfaff8a4673ac550df24e9c1b145c351e1 Mon Sep 17 00:00:00 2001 From: Pavel Boyko Date: Fri, 13 Nov 2009 18:20:50 +0300 Subject: [PATCH] bugfix in YansWifiPhy::SetChannelNumber() --- src/devices/wifi/yans-wifi-phy.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/devices/wifi/yans-wifi-phy.cc b/src/devices/wifi/yans-wifi-phy.cc index 5e6a02099..d3be72062 100644 --- a/src/devices/wifi/yans-wifi-phy.cc +++ b/src/devices/wifi/yans-wifi-phy.cc @@ -317,7 +317,15 @@ YansWifiPhy::SetChannel (Ptr channel) void YansWifiPhy::SetChannelNumber (uint16_t nch) { - NS_ASSERT(!IsStateSwitching()); + if (Simulator::Now () == Seconds (0)) + { + // this is not channel switch, this is initialization + NS_LOG_DEBUG("start at channel " << nch); + m_channelNumber = nch; + return; + } + + NS_ASSERT (!IsStateSwitching()); switch (m_state->GetState ()) { case YansWifiPhy::SYNC: NS_LOG_DEBUG ("drop packet because of channel switching while reception");