* Fixed a few more problems that the test application revealed. This should
also close #2594. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28883 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
124ee2f4ef
commit
518720875d
@ -83,11 +83,18 @@ BufferQueue::Add(net_buffer *buffer, tcp_sequence sequence)
|
||||
fContiguousBytes));
|
||||
VERIFY();
|
||||
|
||||
if (tcp_sequence(sequence + buffer->size) <= fFirstSequence) {
|
||||
if (tcp_sequence(sequence + buffer->size) <= fFirstSequence
|
||||
|| buffer->size == 0) {
|
||||
// This buffer does not contain any data of interest
|
||||
gBufferModule->free(buffer);
|
||||
return;
|
||||
}
|
||||
if (sequence < fFirstSequence) {
|
||||
// Remove the stuff we already have
|
||||
|
||||
gBufferModule->remove_header(buffer, fFirstSequence - sequence);
|
||||
sequence = fFirstSequence;
|
||||
}
|
||||
|
||||
if (fList.IsEmpty() || sequence >= fLastSequence) {
|
||||
// we usually just add the buffer to the end of the queue
|
||||
@ -166,7 +173,7 @@ BufferQueue::Add(net_buffer *buffer, tcp_sequence sequence)
|
||||
&& tcp_sequence(sequence + buffer->size) > next->sequence) {
|
||||
// we already have at least part of this data
|
||||
if (tcp_sequence(next->sequence + next->size)
|
||||
< sequence + buffer->size) {
|
||||
<= sequence + buffer->size) {
|
||||
net_buffer *remove = next;
|
||||
next = (net_buffer *)next->link.next;
|
||||
|
||||
@ -469,7 +476,7 @@ BufferQueue::Dump() const
|
||||
SegmentList::ConstIterator iterator = fList.GetIterator();
|
||||
int32 number = 0;
|
||||
while (net_buffer* buffer = iterator.Next()) {
|
||||
kprintf(" %ld. buffer %p, sequence %lx, size %lu\n", ++number,
|
||||
kprintf(" %ld. buffer %p, sequence %lu, size %lu\n", ++number,
|
||||
buffer, buffer->sequence, buffer->size);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user