From 914c48cad71e3fd5483d978b5b61fdd5772509f8 Mon Sep 17 00:00:00 2001 From: Hugo Santos Date: Tue, 10 Apr 2007 17:00:22 +0000 Subject: [PATCH] eat header space in each iteration in prepend_size(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20641 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/network/stack/net_buffer.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/add-ons/kernel/network/stack/net_buffer.cpp b/src/add-ons/kernel/network/stack/net_buffer.cpp index 31223a37f4..efad0350f9 100644 --- a/src/add-ons/kernel/network/stack/net_buffer.cpp +++ b/src/add-ons/kernel/network/stack/net_buffer.cpp @@ -651,14 +651,14 @@ prepend_size(net_buffer *_buffer, size_t size, void **_contiguousBuffer) header->first_node = node; list_insert_item_before(&buffer->buffers, previous, node); - } else { - size_t willConsume = min_c(size, node->header_space); - - node->header_space -= willConsume; - node->start -= willConsume; - node->used += willConsume; - bytesLeft -= willConsume; } + + size_t willConsume = min_c(bytesLeft, node->header_space); + + node->header_space -= willConsume; + node->start -= willConsume; + node->used += willConsume; + bytesLeft -= willConsume; } while (bytesLeft > 0); size_t offset = 0;