Bugzilla – Bug 679
channel switching causes error
Last modified: 2010-02-11 23:52:13 UTC
I am using the latest dev version of ns-3. I added the following lines into third.cc to see if I can figure out how to use ChannelNumber: insert at line 86 (above the phy.SetChannel (channel.Create ()); line: YansWifiPhy testCN; testCN.SetChannelNumber (1000); When I do this I get an error: "assert failed. file=../src/devices/wifi/wifi-phy-state-helper.cc, line=379, cond="IsStateSwitching()" line 379 is NS_ASSERT(IsStateSwitching()); I checked in yans-wifi-phy.cc for the same assert, and on line 311 it is NS_ASSERT(!IsStateSwitching()); When I added the ! to line 379 of wifi-phy-state-helper.cc so that it would be the same as line 311 of yans-wifi-phy.cc, the error went away. I'm not sure if I did something wrong with my attempt at using ChannelNumber, or if the ! got lost.
Sorry, can't reproduce on current ns-3-dev. Patch according to your description attached below. Please check that bug still exist. (In reply to comment #0) > I am using the latest dev version of ns-3. > > I added the following lines into third.cc to see if I can figure out > how to use ChannelNumber: > insert at line 86 (above the phy.SetChannel (channel.Create ()); line: > YansWifiPhy testCN; > testCN.SetChannelNumber (1000); > > > When I do this I get an error: > "assert failed. file=../src/devices/wifi/wifi-phy-state-helper.cc, > line=379, cond="IsStateSwitching()" > line 379 is NS_ASSERT(IsStateSwitching()); > > > I checked in yans-wifi-phy.cc for the same assert, and on line 311 it > is NS_ASSERT(!IsStateSwitching()); > > > When I added the ! to line 379 of wifi-phy-state-helper.cc so that it > would be the same as line 311 of yans-wifi-phy.cc, the error went > away. > > > I'm not sure if I did something wrong with my attempt at using > ChannelNumber, or if the ! got lost.
Created attachment 716 [details] Can't reproduce
I think this may have been a case of trying to change channels when the sender was sending. As far as I can tell, that will still cause an assert error in the code. I'm not sure if there is a way to allow channel switching to be scheduled even when a node is sending, even if you let the node finish sending and then switch the channel. Michael
(In reply to comment #3) > I think this may have been a case of trying to change channels when the sender > was sending. As far as I can tell, that will still cause an assert error in > the code. I'm not sure if there is a way to allow channel switching to be > scheduled even when a node is sending, even if you let the node finish sending > and then switch the channel. > > Michael Michael, Can you verify that this is still a problem? Based on your first post, I can't reproduce the assert either. After looking at the code (again), it seems like the asserts are correct. In wifi-phy-state-helper, the assert is making sure that we are in the switching state, since that is the task of the method. In yans-wifi-phy, the assert is making sure that we *aren't* in the switching state as we are trying to switch now (and trying to switch in the middle of switching, I guess isn't a good idea).
I'm not sure what caused the original problem, I can't reproduce it either. I was getting the assert in another situation, but there was an error in my program. I was trying to change to two channels at the same time. Michael