|
|
| 1689 |
|| (m_vtS == m_vtMs)) |
1689 |
|| (m_vtS == m_vtMs)) |
| 1690 |
{ |
1690 |
{ |
| 1691 |
NS_LOG_INFO ("txonBuffer and retxBuffer empty. Move PDUs up to = " << m_vtS.GetValue () - 1 << " to retxBuffer"); |
1691 |
NS_LOG_INFO ("txonBuffer and retxBuffer empty. Move PDUs up to = " << m_vtS.GetValue () - 1 << " to retxBuffer"); |
| 1692 |
uint16_t sn = 0; |
1692 |
for (SequenceNumber10 sn = m_vtA; sn < m_vtS; sn++) |
| 1693 |
uint16_t acked = m_vtA.GetValue(); |
|
|
| 1694 |
uint16_t sent = m_vtS.GetValue (); |
| 1695 |
if(acked <= sent) //If no overflow, no change. |
| 1696 |
{ |
1693 |
{ |
| 1697 |
for ( sn = m_vtA.GetValue(); sn < m_vtS.GetValue (); sn++ ) |
1694 |
bool pduAvailable = m_txedBuffer.at (sn.GetValue ()).m_pdu != 0; |
| 1698 |
{ |
|
|
| 1699 |
bool pduAvailable = m_txedBuffer.at (sn).m_pdu != 0; |
| 1700 |
|
1695 |
|
| 1701 |
if ( pduAvailable ) |
1696 |
if ( pduAvailable ) |
| 1702 |
{ |
1697 |
{ |
| 1703 |
NS_LOG_INFO ("Move PDU " << sn << " from txedBuffer to retxBuffer"); |
1698 |
uint16_t snValue = sn.GetValue (); |
| 1704 |
m_retxBuffer.at (sn).m_pdu = m_txedBuffer.at (sn).m_pdu->Copy (); |
1699 |
NS_LOG_INFO ("Move PDU " << sn << " from txedBuffer to retxBuffer"); |
| 1705 |
m_retxBuffer.at (sn).m_retxCount = m_txedBuffer.at (sn).m_retxCount; |
1700 |
m_retxBuffer.at (snValue).m_pdu = m_txedBuffer.at (snValue).m_pdu->Copy (); |
| 1706 |
m_retxBufferSize += m_retxBuffer.at (sn).m_pdu->GetSize (); |
1701 |
m_retxBuffer.at (snValue).m_retxCount = m_txedBuffer.at (snValue).m_retxCount; |
|
|
1702 |
m_retxBufferSize += m_retxBuffer.at (snValue).m_pdu->GetSize (); |
| 1707 |
|
1703 |
|
| 1708 |
m_txedBufferSize -= m_txedBuffer.at (sn).m_pdu->GetSize (); |
1704 |
m_txedBufferSize -= m_txedBuffer.at (snValue).m_pdu->GetSize (); |
| 1709 |
m_txedBuffer.at (sn).m_pdu = 0; |
1705 |
m_txedBuffer.at (snValue).m_pdu = 0; |
| 1710 |
m_txedBuffer.at (sn).m_retxCount = 0; |
1706 |
m_txedBuffer.at (snValue).m_retxCount = 0; |
| 1711 |
} |
1707 |
} |
| 1712 |
} |
|
|
| 1713 |
} |
| 1714 |
else//If overflow happened, we retransmit from acked sequence to 1023, then from 0 to sent sequence. |
| 1715 |
{ |
| 1716 |
for ( sn = m_vtA.GetValue(); sn < 1024; sn++ ) |
| 1717 |
{ |
| 1718 |
bool pduAvailable = m_txedBuffer.at (sn).m_pdu != 0; |
| 1719 |
|
| 1720 |
if ( pduAvailable ) |
| 1721 |
{ |
| 1722 |
NS_LOG_INFO ("Move PDU " << sn << " from txedBuffer to retxBuffer"); |
| 1723 |
m_retxBuffer.at (sn).m_pdu = m_txedBuffer.at (sn).m_pdu->Copy (); |
| 1724 |
m_retxBuffer.at (sn).m_retxCount = m_txedBuffer.at (sn).m_retxCount; |
| 1725 |
m_retxBufferSize += m_retxBuffer.at (sn).m_pdu->GetSize (); |
| 1726 |
|
| 1727 |
m_txedBufferSize -= m_txedBuffer.at (sn).m_pdu->GetSize (); |
| 1728 |
m_txedBuffer.at (sn).m_pdu = 0; |
| 1729 |
m_txedBuffer.at (sn).m_retxCount = 0; |
| 1730 |
} |
| 1731 |
} |
| 1732 |
|
| 1733 |
for ( sn = 0; sn < m_vtS.GetValue (); sn++ ) |
| 1734 |
{ |
| 1735 |
bool pduAvailable = m_txedBuffer.at (sn).m_pdu != 0; |
| 1736 |
|
| 1737 |
if ( pduAvailable ) |
| 1738 |
{ |
| 1739 |
NS_LOG_INFO ("Move PDU " << sn << " from txedBuffer to retxBuffer"); |
| 1740 |
m_retxBuffer.at (sn).m_pdu = m_txedBuffer.at (sn).m_pdu->Copy (); |
| 1741 |
m_retxBuffer.at (sn).m_retxCount = m_txedBuffer.at (sn).m_retxCount; |
| 1742 |
m_retxBufferSize += m_retxBuffer.at (sn).m_pdu->GetSize (); |
| 1743 |
|
| 1744 |
m_txedBufferSize -= m_txedBuffer.at (sn).m_pdu->GetSize (); |
| 1745 |
m_txedBuffer.at (sn).m_pdu = 0; |
| 1746 |
m_txedBuffer.at (sn).m_retxCount = 0; |
| 1747 |
} |
| 1748 |
} |
| 1749 |
} |
1708 |
} |
| 1750 |
} |
1709 |
} |
| 1751 |
|
1710 |
|