named-data-ndnSIM / ndnSIM

ndnSIM: NS-3 based NDN simulator
GNU General Public License v3.0
108 stars 165 forks source link

ConsumerCbr::SetRandomize doesn't always set new value on second call #35

Closed yoursunny closed 11 years ago

yoursunny commented 11 years ago

Steps to reproduce:

  1. run this script
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/ndnSIM-module.h"

using namespace ns3;

int main(int argc, char *argv[]) {
  NodeContainer nodes;
  nodes.Create(1);

  ndn::StackHelper ndnHelper;
  ndnHelper.InstallAll();

  ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
  consumerHelper.SetAttribute("Randomize", StringValue("uniform"));
  ApplicationContainer apps = consumerHelper.Install(nodes.Get(0));
  apps.Get(0)->SetAttribute("Randomize", StringValue("none"));

  Simulator::Stop(Seconds(5.0));

  Simulator::Run();
  Simulator::Destroy();

  return 0;
}

Expected: simulation completes without memory error Actual: program terminated with signal SIGSERV

yoursunny commented 11 years ago

Suggested fix: change else if to if on https://github.com/NDN-Routing/ndnSIM/blob/eae83eec953324a6b5784d8ec8ca4fc711cd8a6a/apps/ndn-consumer-cbr.cc#L114