Python: only call ns3::Simulator::RunOne if we're running the default event scheduler; partially fixes Bug 631.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Tue, 10 Aug 2010 12:16:10 +0100
changeset 6541 2f20df778b76
parent 6540 d2768932d6c3
child 6542 ae05357f4906
Python: only call ns3::Simulator::RunOne if we're running the default event scheduler; partially fixes Bug 631.
bindings/python/ns3module_helpers.cc
--- a/bindings/python/ns3module_helpers.cc	Tue Aug 10 10:55:05 2010 +0100
+++ b/bindings/python/ns3module_helpers.cc	Tue Aug 10 12:16:10 2010 +0100
@@ -285,7 +285,15 @@
                     PyObject **return_exception)
 {
     const char *keywords[] = {"signal_check_frequency", NULL};
-    int signal_check_frequency = 100;
+    int signal_check_frequency;
+
+    ns3::Ptr<ns3::DefaultSimulatorImpl> defaultSim =
+        ns3::DynamicCast<ns3::DefaultSimulatorImpl> (ns3::Simulator::GetImplementation ());
+    if (defaultSim) {
+        signal_check_frequency = 100;
+    } else {
+        signal_check_frequency = -1;
+    }
     
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "|i", (char **) keywords, &signal_check_frequency)) {
         PyObject *exc_type, *traceback;