src/aodv/model/aodv-routing-protocol.cc
changeset 11250 06390d19e6f9
parent 11241 db5ae913fd26
child 11432 d2656819dd54
--- a/src/aodv/model/aodv-routing-protocol.cc	Fri Mar 27 11:58:58 2015 -0700
+++ b/src/aodv/model/aodv-routing-protocol.cc	Thu Mar 19 20:03:57 2015 -0700
@@ -582,12 +582,6 @@
   NS_ASSERT (ipv4 != 0);
   NS_ASSERT (m_ipv4 == 0);
 
-  if (EnableHello)
-    {
-      m_htimer.SetFunction (&RoutingProtocol::HelloTimerExpire, this);
-      m_htimer.Schedule (MilliSeconds (m_uniformRandomVariable->GetInteger (0, 100)));
-    }
-
   m_ipv4 = ipv4;
 
   // Create lo route. It is asserted that the only one interface up for now is loopback
@@ -1930,5 +1924,20 @@
   return socket;
 }
 
+void
+RoutingProtocol::DoInitialize (void)
+{
+  NS_LOG_FUNCTION (this);
+  uint32_t startTime;
+  if (EnableHello)
+    {
+      m_htimer.SetFunction (&RoutingProtocol::HelloTimerExpire, this);
+      startTime = m_uniformRandomVariable->GetInteger (0, 100);
+      NS_LOG_DEBUG ("Starting at time " << startTime << "ms");
+      m_htimer.Schedule (MilliSeconds (startTime));
+    }
+  Ipv4RoutingProtocol::DoInitialize ();
 }
-}
+
+} //namespace aodv
+} //namespace ns3