* Fixed one more case of a resulting 0 byte buffer. Also added a test case for
it to the test app. This finally fixes ticket #2594. * Of course, I neither saw this one before, nor did I accidently reproduce it with a test :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28967 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a4ef4a4915
commit
01b60f3d7e
@ -176,9 +176,14 @@ BufferQueue::Add(net_buffer *buffer, tcp_sequence sequence)
|
||||
fList.Remove(remove);
|
||||
fNumBytes -= remove->size;
|
||||
gBufferModule->free(remove);
|
||||
} else {
|
||||
} else if (tcp_sequence(next->sequence) > sequence) {
|
||||
// We have the end of this buffer already
|
||||
gBufferModule->remove_trailer(buffer,
|
||||
sequence + buffer->size - next->sequence);
|
||||
} else {
|
||||
// We already have this data
|
||||
gBufferModule->free(buffer);
|
||||
buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#define DEBUG_BUFFER_QUEUE 1
|
||||
|
||||
#include "BufferQueue.h"
|
||||
@ -129,7 +134,11 @@ main()
|
||||
dump("add 3");
|
||||
|
||||
add(60, 540);
|
||||
dump("add at the end of previous data");
|
||||
dump("added at the end of previous data");
|
||||
|
||||
add(998, 1002);
|
||||
add(500, 1000);
|
||||
dump("added data covered by next");
|
||||
|
||||
put_module(NET_BUFFER_MODULE_NAME);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user