fix indent, basic coding style issues
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sat, 28 Jul 2007 13:22:47 +0200
changeset 997d95ffcec6523
parent 996 3888206177b8
child 998 85906b732a6a
fix indent, basic coding style issues
src/devices/csma-cd/csma-cd-net-device.cc
     1.1 --- a/src/devices/csma-cd/csma-cd-net-device.cc	Sat Jul 28 13:20:47 2007 +0200
     1.2 +++ b/src/devices/csma-cd/csma-cd-net-device.cc	Sat Jul 28 13:22:47 2007 +0200
     1.3 @@ -228,7 +228,9 @@
     1.4    if ((m_encapMode == IP_ARP) || (m_encapMode == LLC))
     1.5      {
     1.6        return true;
     1.7 -    } else {
     1.8 +    } 
     1.9 +  else 
    1.10 +    {
    1.11        return false;
    1.12      }
    1.13  }
    1.14 @@ -248,22 +250,22 @@
    1.15    AddHeader(p, dest, protocolNumber);
    1.16  
    1.17    // Place the packet to be sent on the send queue
    1.18 -    if (m_queue->Enqueue(p) == false )
    1.19 -      {
    1.20 -        return false;
    1.21 -      }
    1.22 -    // If the device is idle, we need to start a transmission. Otherwise,
    1.23 -    // the transmission will be started when the current packet finished
    1.24 -    // transmission (see TransmitCompleteEvent)
    1.25 -    if (m_txMachineState == READY) 
    1.26 -      {
    1.27 -        // Store the next packet to be transmitted
    1.28 -        if (m_queue->Dequeue (m_currentPkt))
    1.29 -          {
    1.30 -            TransmitStart();
    1.31 -          }
    1.32 -      }
    1.33 -    return true;
    1.34 +  if (m_queue->Enqueue(p) == false )
    1.35 +    {
    1.36 +      return false;
    1.37 +    }
    1.38 +  // If the device is idle, we need to start a transmission. Otherwise,
    1.39 +  // the transmission will be started when the current packet finished
    1.40 +  // transmission (see TransmitCompleteEvent)
    1.41 +  if (m_txMachineState == READY) 
    1.42 +    {
    1.43 +      // Store the next packet to be transmitted
    1.44 +      if (m_queue->Dequeue (m_currentPkt))
    1.45 +        {
    1.46 +          TransmitStart();
    1.47 +        }
    1.48 +    }
    1.49 +  return true;
    1.50  }
    1.51  
    1.52  void
    1.53 @@ -292,7 +294,9 @@
    1.54        if (m_backoff.MaxRetriesReached())
    1.55          { // Too many retries reached, abort transmission of packet
    1.56            TransmitAbort();
    1.57 -        } else {
    1.58 +        } 
    1.59 +      else 
    1.60 +        {
    1.61            m_backoff.IncrNumRetries();
    1.62            Time backoffTime = m_backoff.GetBackoffTime();
    1.63  
    1.64 @@ -304,7 +308,9 @@
    1.65                                 &CsmaCdNetDevice::TransmitStart, 
    1.66                                 this);
    1.67          }
    1.68 -    } else {
    1.69 +    } 
    1.70 +  else 
    1.71 +    {
    1.72        // Channel is free, transmit packet
    1.73        m_txMachineState = BUSY;
    1.74        Time tEvent = Seconds (m_bps.CalculateTxTime(m_currentPkt.GetSize()));
    1.75 @@ -322,7 +328,9 @@
    1.76                      "Channel transmit start did not work at " << 
    1.77                      tEvent.GetSeconds () << "sec");
    1.78            m_txMachineState = READY;
    1.79 -        } else {
    1.80 +        } 
    1.81 +      else 
    1.82 +        {
    1.83            // Transmission success, reset backoff time parameters.
    1.84            m_backoff.ResetBackoffTime();
    1.85          }