--- 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
--- 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<Ipv4Address, RoutingTableEntry>::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<Ipv4Address, RoutingTableEntry>::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<Ipv4Address, RoutingTableEntry>::const_iterator i = m_ipv4AddressEntry.begin (); i != m_ipv4AddressEntry.end (); ++i)
{
--- 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<Ipv4Address, RoutingTableEntry> m_ipv4AddressEntry;