merge
This commit is contained in:
@@ -185,7 +185,7 @@ ArpCache::HandleWaitReplyTimeout (void)
|
||||
for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++)
|
||||
{
|
||||
entry = (*i).second;
|
||||
if (entry != 0 && entry->IsWaitReply () && entry->IsExpired ())
|
||||
if (entry != 0 && entry->IsWaitReply () && entry->IsExpiring () )
|
||||
{
|
||||
if (entry->GetRetries () < m_maxRetries)
|
||||
{
|
||||
@@ -358,37 +358,47 @@ ArpCache::Entry::SetIpv4Address (Ipv4Address destination)
|
||||
NS_LOG_FUNCTION (this << destination);
|
||||
m_ipv4Address = destination;
|
||||
}
|
||||
|
||||
bool
|
||||
ArpCache::Entry::IsExpired (void)
|
||||
Time
|
||||
ArpCache::Entry::GetTimeout (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Time timeout;
|
||||
switch (m_state) {
|
||||
case ArpCache::Entry::WAIT_REPLY:
|
||||
timeout = m_arp->GetWaitReplyTimeout ();
|
||||
break;
|
||||
return m_arp->GetWaitReplyTimeout ();
|
||||
case ArpCache::Entry::DEAD:
|
||||
timeout = m_arp->GetDeadTimeout ();
|
||||
break;
|
||||
return m_arp->GetDeadTimeout ();
|
||||
case ArpCache::Entry::ALIVE:
|
||||
timeout = m_arp->GetAliveTimeout ();
|
||||
break;
|
||||
return m_arp->GetAliveTimeout ();
|
||||
default:
|
||||
NS_ASSERT (false);
|
||||
timeout = Seconds (0);
|
||||
return Seconds (0);
|
||||
/* NOTREACHED */
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool
|
||||
ArpCache::Entry::IsExpiring (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Time timeout = GetTimeout ();
|
||||
Time delta = Simulator::Now () - m_lastSeen;
|
||||
if (delta >= timeout)
|
||||
NS_LOG_DEBUG ("delta=" << delta.GetSeconds () << "s");
|
||||
if (delta >= timeout)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool
|
||||
ArpCache::Entry::IsExpired (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Time timeout = GetTimeout ();
|
||||
Time delta = Simulator::Now () - m_lastSeen;
|
||||
NS_LOG_DEBUG ("delta=" << delta.GetSeconds () << "s");
|
||||
if (delta > timeout)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Ptr<Packet>
|
||||
ArpCache::Entry::DequeuePending (void)
|
||||
@@ -408,13 +418,13 @@ ArpCache::Entry::DequeuePending (void)
|
||||
void
|
||||
ArpCache::Entry::UpdateSeen (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
NS_LOG_FUNCTION (m_macAddress << m_ipv4Address);
|
||||
m_lastSeen = Simulator::Now ();
|
||||
}
|
||||
uint32_t
|
||||
ArpCache::Entry::GetRetries (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
NS_LOG_FUNCTION (m_macAddress << m_ipv4Address);
|
||||
return m_retries;
|
||||
}
|
||||
void
|
||||
|
||||
@@ -160,9 +160,25 @@ public:
|
||||
*/
|
||||
void SetIpv4Address (Ipv4Address destination);
|
||||
/**
|
||||
* \return True if this entry has timedout; false otherwise.
|
||||
* \return True if this entry has timed out; false otherwise.
|
||||
*
|
||||
* This function returns true if the time elapsed strictly exceeds
|
||||
* the timeout value (i.e., is not less than or equal to the timeout).
|
||||
* Differs from IsExpiring() only in the boundary condition
|
||||
* delta == timeout.
|
||||
* \see IsExpiring
|
||||
*/
|
||||
bool IsExpired (void);
|
||||
bool IsExpired (void) const;
|
||||
/**
|
||||
* \return True if this entry is timing out or has already timed out;
|
||||
* false otherwise.
|
||||
*
|
||||
* This function returns true if the time elapsed is equal to or exceeds
|
||||
* the timeout value. Differs from IsExpired() only in the boundary
|
||||
* condition delta == timeout.
|
||||
* \see IsExpired
|
||||
*/
|
||||
bool IsExpiring (void) const;
|
||||
|
||||
/**
|
||||
* \returns 0 is no packet is pending, the next packet to send if
|
||||
@@ -191,6 +207,7 @@ public:
|
||||
};
|
||||
|
||||
void UpdateSeen (void);
|
||||
Time GetTimeout (void) const;
|
||||
ArpCache *m_arp;
|
||||
ArpCacheEntryState_e m_state;
|
||||
Time m_lastSeen;
|
||||
|
||||
Reference in New Issue
Block a user