src/devices/csma/backoff.cc
changeset 7044 f94b264549d1
parent 7040 444bb5c76bff
equal deleted inserted replaced
7043:1a8ff65327d0 7044:f94b264549d1
    44 }  
    44 }  
    45 
    45 
    46 Time
    46 Time
    47 Backoff::GetBackoffTime (void)
    47 Backoff::GetBackoffTime (void)
    48 {
    48 {
    49   Time backoff;
       
    50   uint32_t ceiling;
    49   uint32_t ceiling;
    51 
    50 
    52   if ((m_ceiling > 0) &&(m_numBackoffRetries > m_ceiling))
    51   if ((m_ceiling > 0) &&(m_numBackoffRetries > m_ceiling))
    53     {
    52     {
    54       ceiling = m_ceiling;
    53       ceiling = m_ceiling;
    65       maxSlot = m_maxSlots;
    64       maxSlot = m_maxSlots;
    66     }
    65     }
    67 
    66 
    68   uint32_t backoffSlots = (uint32_t)m_rng.GetValue(minSlot, maxSlot);
    67   uint32_t backoffSlots = (uint32_t)m_rng.GetValue(minSlot, maxSlot);
    69 
    68 
    70   backoff = backoffSlots * m_slotTime.To ();
    69   Time backoff = Time (backoffSlots * m_slotTime);
    71   return backoff;
    70   return backoff;
    72 }
    71 }
    73 
    72 
    74 void 
    73 void 
    75 Backoff::ResetBackoffTime (void)
    74 Backoff::ResetBackoffTime (void)