# HG changeset patch # User Borovkova Elena # Date 1249576997 -14400 # Node ID 5236285e38183ae7e78aff6b2ba662283cd1e16b # Parent 26deb6597b422bed4843b454d4597264b5efa9b9 jitter added for hello diff -r 26deb6597b42 -r 5236285e3818 src/routing/aodv/aodv-routing-protocol.cc --- a/src/routing/aodv/aodv-routing-protocol.cc Thu Aug 06 20:05:18 2009 +0400 +++ b/src/routing/aodv/aodv-routing-protocol.cc Thu Aug 06 20:43:17 2009 +0400 @@ -420,7 +420,7 @@ if (EnableHello) { htimer.SetFunction (&RoutingProtocol::HelloTimerExpire, this); - htimer.SetDelay (HelloInterval); + htimer.SetDelay (HelloInterval - Scalar(0.1)*MilliSeconds(UniformVariable().GetValue (0, 1))); } m_ipv4 = ipv4; @@ -526,7 +526,7 @@ if (EnableHello) { htimer.Cancel (); - htimer.Schedule (HelloInterval); + htimer.Schedule (HelloInterval - Scalar(0.1)*MilliSeconds(UniformVariable().GetValue (0, 1))); } } @@ -767,7 +767,7 @@ if (EnableHello) { htimer.Cancel (); - htimer.Schedule (HelloInterval); + htimer.Schedule (HelloInterval - Scalar(0.1)*MilliSeconds(UniformVariable().GetValue (0, 1))); } NS_LOG_LOGIC ("After recieve request"); m_routingTable.Print (std::cout); @@ -1111,7 +1111,7 @@ SendHello (); // TODO select random time for the next hello htimer.Cancel (); - htimer.Schedule (HelloInterval + MilliSeconds(UniformVariable().GetValue (0, 1)) ); + htimer.Schedule (HelloInterval - Scalar(0.1)*MilliSeconds(UniformVariable().GetValue (0, 1)) ); } void diff -r 26deb6597b42 -r 5236285e3818 src/routing/aodv/aodv-rtable.cc --- a/src/routing/aodv/aodv-rtable.cc Thu Aug 06 20:05:18 2009 +0400 +++ b/src/routing/aodv/aodv-rtable.cc Thu Aug 06 20:43:17 2009 +0400 @@ -306,6 +306,7 @@ bool RoutingTable::SetEntryState (Ipv4Address id, RouteFlags state ) { + Purge (); std::map::iterator i = m_ipv4AddressEntry.find (id); if (i == m_ipv4AddressEntry.end ()) return false; @@ -373,6 +374,7 @@ bool RoutingTable::MarkLinkAsUinidirectional (Ipv4Address neighbor, Time blacklistTimeout ) { + Purge (); std::map::iterator i = m_ipv4AddressEntry.find (neighbor); if (i == m_ipv4AddressEntry.end ()) return false; @@ -383,8 +385,9 @@ } void -RoutingTable::Print (std::ostream &os ) const +RoutingTable::Print (std::ostream &os ) { + Purge (); os << "\nAODV Routing table\n" << "Destination\tGateway\t\tInterface\tFlag\tExpire\n"; for (std::map::const_iterator i = m_ipv4AddressEntry.begin (); i != m_ipv4AddressEntry.end (); ++i) { diff -r 26deb6597b42 -r 5236285e3818 src/routing/aodv/aodv-rtable.h --- a/src/routing/aodv/aodv-rtable.h Thu Aug 06 20:05:18 2009 +0400 +++ b/src/routing/aodv/aodv-rtable.h Thu Aug 06 20:43:17 2009 +0400 @@ -236,7 +236,7 @@ */ bool MarkLinkAsUinidirectional(Ipv4Address neighbor, Time blacklistTimeout); /// Print routing table - void Print(std::ostream &os) const; + void Print(std::ostream &os); private: std::map m_ipv4AddressEntry;