* Add() did not add fNumBytes in case of an out of order packet, causing all kinds of

hickups on TCP connections.
* Added a bit more of debug output to Add().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19817 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-01-15 18:00:39 +00:00
parent bbaa26a490
commit 04121b1396
@@ -1,5 +1,5 @@
/* /*
* Copyright 2006, Haiku, Inc. All Rights Reserved. * Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -71,6 +71,7 @@ BufferQueue::Add(net_buffer *buffer, tcp_sequence sequence)
{ {
TRACE(("BufferQueue@%p::Add(buffer %p, size %lu, sequence %lu)\n", TRACE(("BufferQueue@%p::Add(buffer %p, size %lu, sequence %lu)\n",
this, buffer, buffer->size, (uint32)sequence)); this, buffer, buffer->size, (uint32)sequence));
TRACE((" in: first: %lu, last: %lu, num: %lu, cont: %lu\n", (uint32)fFirstSequence, (uint32)fLastSequence, fNumBytes, fContiguousBytes));
buffer->sequence = sequence; buffer->sequence = sequence;
@@ -85,6 +86,7 @@ BufferQueue::Add(net_buffer *buffer, tcp_sequence sequence)
fLastSequence = sequence + buffer->size; fLastSequence = sequence + buffer->size;
fNumBytes += buffer->size; fNumBytes += buffer->size;
TRACE((" out0: first: %lu, last: %lu, num: %lu, cont: %lu\n", (uint32)fFirstSequence, (uint32)fLastSequence, fNumBytes, fContiguousBytes));
return; return;
} }
@@ -141,10 +143,13 @@ BufferQueue::Add(net_buffer *buffer, tcp_sequence sequence)
gBufferModule->remove_trailer(buffer, next->sequence - (sequence + buffer->size)); gBufferModule->remove_trailer(buffer, next->sequence - (sequence + buffer->size));
} }
if (buffer == NULL) if (buffer == NULL) {
TRACE((" out1: first: %lu, last: %lu, num: %lu, cont: %lu\n", (uint32)fFirstSequence, (uint32)fLastSequence, fNumBytes, fContiguousBytes));
return; return;
}
fList.Insert(next, buffer); fList.Insert(next, buffer);
fNumBytes += buffer->size;
// we might need to update the number of bytes available // we might need to update the number of bytes available
@@ -160,6 +165,8 @@ BufferQueue::Add(net_buffer *buffer, tcp_sequence sequence)
buffer = (struct net_buffer *)buffer->link.next; buffer = (struct net_buffer *)buffer->link.next;
} while (buffer != NULL && fFirstSequence + fContiguousBytes == buffer->sequence); } while (buffer != NULL && fFirstSequence + fContiguousBytes == buffer->sequence);
} }
TRACE((" out2: first: %lu, last: %lu, num: %lu, cont: %lu\n", (uint32)fFirstSequence, (uint32)fLastSequence, fNumBytes, fContiguousBytes));
} }