* copy_meta_data() also copied the size of the buffer, which wasn't such a good
idea. Splitting large buffers no longer causes KDL. * merge_buffer() now maintains the size of the source buffer while removing its nodes. * The paranoia checks run through again now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35073 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
|
* Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
* Ingo Weinhold, [email protected]
|
* Ingo Weinhold, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
|
||||||
#include <net_buffer.h>
|
#include <net_buffer.h>
|
||||||
@@ -1028,7 +1029,6 @@ copy_metadata(net_buffer* destination, const net_buffer* source)
|
|||||||
destination->flags = source->flags;
|
destination->flags = source->flags;
|
||||||
destination->interface = source->interface;
|
destination->interface = source->interface;
|
||||||
destination->offset = source->offset;
|
destination->offset = source->offset;
|
||||||
destination->size = source->size;
|
|
||||||
destination->protocol = source->protocol;
|
destination->protocol = source->protocol;
|
||||||
destination->type = source->type;
|
destination->type = source->type;
|
||||||
}
|
}
|
||||||
@@ -1151,6 +1151,7 @@ duplicate_buffer(net_buffer* _buffer)
|
|||||||
|
|
||||||
copy_metadata(duplicate, buffer);
|
copy_metadata(duplicate, buffer);
|
||||||
|
|
||||||
|
ASSERT(duplicate->size == buffer->size);
|
||||||
CHECK_BUFFER(buffer);
|
CHECK_BUFFER(buffer);
|
||||||
CHECK_BUFFER(duplicate);
|
CHECK_BUFFER(duplicate);
|
||||||
RUN_PARANOIA_CHECKS(duplicate);
|
RUN_PARANOIA_CHECKS(duplicate);
|
||||||
@@ -1189,6 +1190,7 @@ clone_buffer(net_buffer* _buffer, bool shareFreeSpace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy_metadata(clone, buffer);
|
copy_metadata(clone, buffer);
|
||||||
|
ASSERT(clone->size == buffer->size);
|
||||||
|
|
||||||
return clone;
|
return clone;
|
||||||
|
|
||||||
@@ -1259,6 +1261,7 @@ clone_buffer(net_buffer* _buffer, bool shareFreeSpace)
|
|||||||
|
|
||||||
copy_metadata(clone, buffer);
|
copy_metadata(clone, buffer);
|
||||||
|
|
||||||
|
ASSERT(clone->size == buffer->size);
|
||||||
CREATE_PARANOIA_CHECK_SET(clone, "net_buffer");
|
CREATE_PARANOIA_CHECK_SET(clone, "net_buffer");
|
||||||
SET_PARANOIA_CHECK(PARANOIA_SUSPICIOUS, clone, &clone->size,
|
SET_PARANOIA_CHECK(PARANOIA_SUSPICIOUS, clone, &clone->size,
|
||||||
sizeof(clone->size));
|
sizeof(clone->size));
|
||||||
@@ -1363,6 +1366,7 @@ merge_buffer(net_buffer* _buffer, net_buffer* _with, bool after)
|
|||||||
// The node is already in the buffer, we can just move it
|
// The node is already in the buffer, we can just move it
|
||||||
// over to the new owner
|
// over to the new owner
|
||||||
list_remove_item(&with->buffers, node);
|
list_remove_item(&with->buffers, node);
|
||||||
|
with->size -= node->used;
|
||||||
} else {
|
} else {
|
||||||
// we need a new place for this node
|
// we need a new place for this node
|
||||||
data_node* newNode = add_data_node(buffer, node->header);
|
data_node* newNode = add_data_node(buffer, node->header);
|
||||||
|
|||||||
Reference in New Issue
Block a user