diff --git a/build/config_headers/kernel_debug_config.h b/build/config_headers/kernel_debug_config.h index 1dcc08f2c5..2a0b4d653f 100644 --- a/build/config_headers/kernel_debug_config.h +++ b/build/config_headers/kernel_debug_config.h @@ -140,4 +140,10 @@ #define SYSTEM_PROFILE_INTERVAL 10000 +// Network + +// Enables additional assertions in the tcp add-on. +#define DEBUG_TCP_BUFFER_QUEUE KDEBUG_LEVEL_2 + + #endif // KERNEL_DEBUG_CONFIG_H diff --git a/src/add-ons/kernel/network/protocols/tcp/BufferQueue.cpp b/src/add-ons/kernel/network/protocols/tcp/BufferQueue.cpp index de83ba3b31..4d5ada0a27 100644 --- a/src/add-ons/kernel/network/protocols/tcp/BufferQueue.cpp +++ b/src/add-ons/kernel/network/protocols/tcp/BufferQueue.cpp @@ -19,7 +19,7 @@ # define TRACE(x) #endif -#if DEBUG_BUFFER_QUEUE +#if DEBUG_TCP_BUFFER_QUEUE # define VERIFY() Verify(); #else # define VERIFY() ; @@ -436,7 +436,7 @@ BufferQueue::SetPushPointer() fPushPointer = fList.Tail()->sequence + fList.Tail()->size; } -#if DEBUG_BUFFER_QUEUE +#if DEBUG_TCP_BUFFER_QUEUE /*! Perform a sanity check of the whole queue. */ @@ -486,4 +486,4 @@ BufferQueue::Dump() const } } -#endif // DEBUG_BUFFER_QUEUE +#endif // DEBUG_TCP_BUFFER_QUEUE diff --git a/src/add-ons/kernel/network/protocols/tcp/BufferQueue.h b/src/add-ons/kernel/network/protocols/tcp/BufferQueue.h index 73986a880c..f428ae921b 100644 --- a/src/add-ons/kernel/network/protocols/tcp/BufferQueue.h +++ b/src/add-ons/kernel/network/protocols/tcp/BufferQueue.h @@ -13,10 +13,6 @@ #include -#ifndef DEBUG_BUFFER_QUEUE -# define DEBUG_BUFFER_QUEUE 1 -#endif - typedef DoublyLinkedList > SegmentList; @@ -55,7 +51,7 @@ public: tcp_sequence NextSequence() const { return fFirstSequence + fContiguousBytes; } -#if DEBUG_BUFFER_QUEUE +#if DEBUG_TCP_BUFFER_QUEUE void Verify() const; void Dump() const; #endif diff --git a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp index 9640f8b065..0c4d9cae6a 100644 --- a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp +++ b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp @@ -2533,7 +2533,7 @@ TCPEndpoint::Dump() const kprintf(" max segment size: %" B_PRIu32 "\n", fSendMaxSegmentSize); kprintf(" queue: %" B_PRIuSIZE " / %" B_PRIuSIZE "\n", fSendQueue.Used(), fSendQueue.Size()); -#if DEBUG_BUFFER_QUEUE +#if DEBUG_TCP_BUFFER_QUEUE fSendQueue.Dump(); #endif kprintf(" last acknowledge sent: %" B_PRIu32 "\n", @@ -2549,7 +2549,7 @@ TCPEndpoint::Dump() const kprintf(" max segment size: %" B_PRIu32 "\n", fReceiveMaxSegmentSize); kprintf(" queue: %" B_PRIuSIZE " / %" B_PRIuSIZE "\n", fReceiveQueue.Available(), fReceiveQueue.Size()); -#if DEBUG_BUFFER_QUEUE +#if DEBUG_TCP_BUFFER_QUEUE fReceiveQueue.Dump(); #endif kprintf(" initial sequence: %" B_PRIu32 "\n", diff --git a/src/tests/system/network/tcp_shell/BufferQueueTest.cpp b/src/tests/system/network/tcp_shell/BufferQueueTest.cpp index ef8cbe01b4..ed54d35aa0 100644 --- a/src/tests/system/network/tcp_shell/BufferQueueTest.cpp +++ b/src/tests/system/network/tcp_shell/BufferQueueTest.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#define DEBUG_BUFFER_QUEUE 1 +#define DEBUG_TCP_BUFFER_QUEUE 1 #include "BufferQueue.h"