src/devices/wifi/mac-low.cc
changeset 2176 8a8305b75bed
parent 2172 eb1adef495b6
child 2177 d2d60d000963
equal deleted inserted replaced
2175:9c2c6fbf65a7 2176:8a8305b75bed
   996 {
   996 {
   997   /* send the third step in a 
   997   /* send the third step in a 
   998    * RTS/CTS/DATA/ACK hanshake 
   998    * RTS/CTS/DATA/ACK hanshake 
   999    */
   999    */
  1000   NS_ASSERT (m_currentPacket != 0);
  1000   NS_ASSERT (m_currentPacket != 0);
       
  1001   StartDataTxTimers ();
       
  1002 
  1001   WifiMode dataTxMode = GetDataTxMode (m_currentHdr.GetAddr1 (), GetCurrentSize ());
  1003   WifiMode dataTxMode = GetDataTxMode (m_currentHdr.GetAddr1 (), GetCurrentSize ());
  1002 
  1004   Time newDuration = Seconds (0);
  1003   StartDataTxTimers ();
  1005   newDuration += GetSifs ();
       
  1006   newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxMode);
  1004   Time txDuration = m_phy->CalculateTxDuration (GetCurrentSize (), dataTxMode, WIFI_PREAMBLE_LONG);
  1007   Time txDuration = m_phy->CalculateTxDuration (GetCurrentSize (), dataTxMode, WIFI_PREAMBLE_LONG);
  1005   duration -= txDuration;
  1008   duration -= txDuration;
  1006   duration -= GetSifs ();
  1009   duration -= GetSifs ();
       
  1010 
       
  1011   duration = std::max (duration, newDuration);
  1007   NS_ASSERT (duration >= MicroSeconds (0));
  1012   NS_ASSERT (duration >= MicroSeconds (0));
  1008   m_currentHdr.SetDuration (duration);
  1013   m_currentHdr.SetDuration (duration);
  1009 
  1014 
  1010   m_currentPacket->AddHeader (m_currentHdr);
  1015   m_currentPacket->AddHeader (m_currentHdr);
  1011   WifiMacTrailer fcs;
  1016   WifiMacTrailer fcs;