network: Move empty zero area to the end of buffer if needed
If the first buffer has empty zero area, it can be moved to the end of the buffer and concatenated to the zero area of the added buffer instead of falling back to the slow path.
This commit is contained in:
committed by
Tom Henderson
parent
310052adab
commit
ae87cd35f9
@@ -400,8 +400,9 @@ void
|
||||
Buffer::AddAtEnd (const Buffer &o)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &o);
|
||||
|
||||
if (m_data->m_count == 1 &&
|
||||
m_end == m_zeroAreaEnd &&
|
||||
(m_end == m_zeroAreaEnd || m_zeroAreaStart == m_zeroAreaEnd) &&
|
||||
m_end == m_data->m_dirtyEnd &&
|
||||
o.m_start == o.m_zeroAreaStart &&
|
||||
o.m_zeroAreaEnd - o.m_zeroAreaStart > 0)
|
||||
@@ -411,8 +412,12 @@ Buffer::AddAtEnd (const Buffer &o)
|
||||
* we attempt to aggregate two buffers which contain
|
||||
* adjacent zero areas.
|
||||
*/
|
||||
if (m_zeroAreaStart == m_zeroAreaEnd)
|
||||
{
|
||||
m_zeroAreaStart = m_end;
|
||||
}
|
||||
uint32_t zeroSize = o.m_zeroAreaEnd - o.m_zeroAreaStart;
|
||||
m_zeroAreaEnd += zeroSize;
|
||||
m_zeroAreaEnd = m_end + zeroSize;
|
||||
m_end = m_zeroAreaEnd;
|
||||
m_data->m_dirtyEnd = m_zeroAreaEnd;
|
||||
uint32_t endData = o.m_end - o.m_zeroAreaEnd;
|
||||
|
||||
Reference in New Issue
Block a user