History log of /haiku/src/add-ons/kernel/network/protocols/tcp/BufferQueue.cpp
Revision Date Author Comments
# ce08f03c 01-Apr-2023 Augustin Cavalier <waddlesplash@gmail.com>

kernel & add-ons: Adjustments to use DoublyLinkedList::InsertBefore.

The Insert(before, element) function has been marked deprecated since
2010, but still had many usage and kept accumulating more. It's long
past time we got rid of all them and actually deprecated the function
itself.

Insert(before, element) just calls InsertBefore, so no functional change.


# a939e873 09-May-2021 Jérôme Duval <jerome.duval@gmail.com>

tcp: fix trace build for BufferQueue

Change-Id: Iab502bdff3da23dff74972e6c480e0784ab3f4dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3905
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


# 745830a0 25-Aug-2017 A-star-ayush <myselfthebest@yahoo.com>

tcp: rfc 2018: implemented SACK option

Change-Id: I269ad2682446c4d37bae21dcf9f3036de964ff2c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/53
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 44a4bc5f 22-May-2020 Kyle Ambroff-Kao <kyle@ambroffkao.com>

tcp: Remove sanity checks from BufferQueue in release builds

Each TCPEndpoint has two BufferQueue members, one for the send queue
and one for the receive queue.

If DEBUG_BUFFER_QUEUE is enabled, then most methods of BufferQueue
call BufferQueue::Verify(), sometimes twice. This member function
performs some sanity checking which requires iterating through every
net_buffer in the queue.

Disabling this in a debug build improved throughput by a factor of 5x
over the loopback interface on my laptop. Using iperf the measured
throughput went from 900Mbps to around 4.8Gbps.

This patch turns this sanity checking off for release builds.

* Rename DEBUG_BUFFER_QUEUE to DEBUG_TCP_BUFFER_QUEUE
* Change the default in BufferQueue.h to disabled
* Set DEBUG_TCP_BUFFER_QUEUE to KDEBUG_LEVEL_2 in
kernel_debug_config.h

Change-Id: I262dac5d7e2889d2942bbdcf6b667cc0cbafa4c8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2780
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# d815bbcb 04-Oct-2017 Jérôme Duval <jerome.duval@gmail.com>

Revert "tcp: rfc 2018: implemented SACK option"

This reverts commit 5c31f5a67a0aa37c8f2a1464252b2c5b0a959f33.


# 5c31f5a6 25-Aug-2017 A-star-ayush <myselfthebest@yahoo.com>

tcp: rfc 2018: implemented SACK option

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>


# 6d796a84 10-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed up network stack and drivers for x86_64.

* Various compilation fixes.
* Fixes to the FreeBSD compatibility layer (from comparing the x86-
specific bits with the equivalent amd64 sources in FreeBSD).
* Compile all the Ethernet drivers except for sis900 and wb840, these
require a bit more work to fix (will file a ticket soon). Tested
ipro1000 and rtl81xx, no issues.


# 965abdeb 15-Feb-2010 Axel Dörfler <axeld@pinc-software.de>

* BufferQueue::Free() no longer will return negative values. As is, the max
bytes restriction is only a soft limit. This fixes stalling TCP connections
because everything received would be out of window once this happened.
* Added a TODO to look into TCP's window management - it doesn't seem to be
right.
* Fixed build with tracing turned on.
* Made the fNumber member of tcp_sequence private.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35468 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c21f81c1 04-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

bonefish + axeld:
* There was one incorrect check in BufferQueue::Get() that happened because
the wrong operator was used due to the uint32 cast operator.
* Consequently, we removed the uint32 cast operator, and changed the code
to deal with this. Fortunately, no other bugs were observed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29928 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 01b60f3d 20-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* 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


# 93f76bfb 19-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Turns out the assert was wrong; since the previous buffer can be adjacent to
the next buffer, it can also cause the new buffer to start at the same
sequence as the next buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28958 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0c1404ba 18-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* The check to remove bytes at the beginning happened twice.
* There was an off-by-one error that could well be responsible for bug
#2594. Haven't tested it yet, though.
* Added an extra assert to make sure that "next" is set correctly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28937 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 51872087 11-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed a few more problems that the test application revealed. This should
also close #2594.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28883 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b3cb15e2 11-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Applied most parts of Adrian's patch in #2594, applied our coding style.
* Cleaned the net_buffer::sequence handling, and fixed a few more problems of
maintaining it in Add().
* Extended Verify() to check everything that's possible, and call it
conditionally on several places, depending on DEBUG_BUFFER_QUEUE. It's turned
on for now which means that any remaining problems should show up when they
happened.
* Call Dump() from TCPEndpoint::Dump().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28878 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0e5a3fc6 08-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* BufferQueue::Get(size_t ...) now always returns successfully if it does not
return an empty buffer. This should avoid losing data in case not everything
could be appended due to a resource shortage.
* Also, it now assures that fNumBytes and fContiguousBytes are always
maintained correctly, thanks to Adrian for pointing this out! This should
fix bug #2594.
* Added extra debug code to BufferQueue::RemoveUntil() so that it checks
whether or not fContiguousBytes could be maintained correctly (ie. if this
function is called only as thought).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28859 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4e9bf24d 12-Sep-2008 Michael Lotz <mmlr@mlotz.ch>

CID 26: The status variable was shadowed inside the while loop causing the outer
status to always be B_OK, resulting in an incomplete buffer instead of an error
if the append failed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27469 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1d0b34fa 23-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* If a new buffer had its last part in common with an existing larger buffer,
BufferQueue::Add() tried to remove a negative amount of bytes. This could
bring a download to a complete halt (as could the other one due to the list
link mixup).
* While the RTT computation still seems to work not that good (with a drop quote
of 50% I would easily reach retransmit timeouts of 80 secs), TCP should now
work a lot better on a flaky connection.
* Renamed _GetMSS() to _MaxSegmentSize().
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22677 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c70d3baf 20-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

more TCP fixes, we should now be able to send large amounts of data through congestioned links.

- fixed BufferQueue's RemoveUntil.
- reset SND.NXT on third duplicate ACK (fast retransmit).
- on retransmit reset SND.NXT to SND.UNA (it will be updated back when we get good ACKs).
- fixed effective window calculation.
- relaxed SWS checking a bit, don't send partial packets on retransmission as the window might have been reduced due to congestion.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20769 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a7edede4 09-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

fixed multiple TCP issues.

- Moved FIN handling to after Segment Text handling, it matches the RFC and fixes a possible issue with a user missing some final segment data when receiving a FIN.
- Fixed the FIN handling to better terminate connections (no more senseless chatter in the end with RSTs etc).
- When Bind()ing, set the socket address so a call to getsockname() gets the allocated port correctly.
- After reaching the ESTABLISHED state, try to wake all pending threads (still needs work).
- Corrected the maximum amount of time we wait in SendData() to respect socket->send.timeout.
- Now ReadData() behaves correctly in all possible states.
- There was a missing handling of MSG_DONTWAIT, fixed.
- Better internal handling of PSH.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20624 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fcd6d8cd 04-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

keep PUSH'ed pointer in receiver side of TCP so we can wait for more data in recv()


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20569 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 04121b13 15-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

* 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


# af3a31f7 01-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Calmed down the networking stack a lot - since it basically works, there is no
reason to slow it down with debug output that much; this will also help investigating
some issues where you just aren't interested in most of the output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19672 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6cf91f95 04-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

Before freeing "next", it should have been removed already...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19422 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7e85d85e 30-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* TCPConnection::SendData() now waits until there is enough free space in
the send queue (however, if the buffer sent is larger than the maximum
buffer, it will just hang for now...). The check is also not thread-safe.
* BufferQueue::Get() did not correctly maintain the fFirstSequence member
in remove mode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19403 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 02894e36 30-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* Reintroduced the accept semaphore: it will be inherited by the new connections
of a LISTEN socket.
* Reading data should now more or less work, too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19401 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 26417177 29-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

More work-in-progress:
* Added some timer methods
* Fixed removing the connection too early (and thus replying with a RST instead of nothing
when the peer acknowledged our FIN).
* BufferQueue::RemoveUntil() did not bump the buffer's sequence
* Delayed acknowledge, and retransmitting should work now (the latter is *very* basic
right now)
* Completed TCPConnection::_ShouldSendSegment()
* fReceiveNext was always updated on a received buffer, even if there was a buffer
missing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19396 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 75dc7cb5 28-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* Renamed _SendQueuedData() to _SendQueued(), and made it independent from the
"flags" parameter - this can't be used with retransmitting anyway, and since
the flags are actually fixed per state, the previous solution didn't really
make much sense.
* Made _SendQueued() work a lot more like BSD's tcp_output().
* We can now send even large buffers that need more than one segment at once.
* Added a simple recursive locking mechanism for now - this should be done
differently, though, as we want to have good performance in full duplex mode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19384 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 85359054 27-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Some more work-in-progress:
* the TCPConnection::Receive() method is now more or less working as it should;
of course, there are a number of missing things (like round-trip time estimation,
retransmit timers, receive window update, ...).
* reply_with_reset() was broken, and accidently always send the segment it should
answer with reset... (causing an endless loop during connect)
* BufferQueue::RemoveUntil() must always set the fFirstSequence member to the new
sequence, or you will never be able to send anything with that queue (as the
data in it would be no longer contiguous).
* connects, sendings (only single segments), and receiving data is working now
basically (but very incomplete); retransmits or even subsequent transmits (if
the data to be sent doesn't fit in one segment) doesn't work yet, so you better
don't lose any segments :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19378 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1166a4f9 26-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Work-in-progress on TCP:
* Changed the implementation to be more BSD like; state variables are now
the same set as usual.
* The BufferQueue didn't use the initial sequence correctly (problems with
SYN sequence).
* It now also removes data out of the current data set (ie. data that was
already read by the application).
* BufferQueue::Get() also didn't work correctly (the version used by sending
data).
* Fixed various issues around the code like incorrect handling of unexpected
data.
* TCP options don't need the end-of-options marker in case they fill up the
data already, also, the end-of-options marker doesn't need to be padded.
* Options are now only processed during SYN - other options may come
later (timestamps are candidate number one).
* Also broke what was working before: connections do no longer work!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19376 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5fcf0448 25-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* Added a helper class tcp_sequence which hides the semantics of comparing sequences
(this was completely broken in the code before).
* Wrote a buffer queue class to replace the previous algorithm - instead of merging
all buffers together, they're kept in a list, so that the most work will be done
in the application's thread and only very little when the data is received; maybe
we should add an append_move() function to net_buffer, and use that instead,
though, to keep the number of fragments small.
* The advertised receive window is now bound to 65535, the receive window shift
is correctly computed, but not yet used.
* The new buffer queue is now also responsible for the send buffer.
* TCPConnection::ListenReceive() used the wrong address to retrieve the target route.
* Fixed TCPConnection::ReadData() to also return data when the connection is already
closed, and to wait if the connection is not yet established (in SO_NONBLOCK mode);
it still doesn't wait until data is available, though...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19372 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6d796a84bd484ccc4fb072a29c663b660180ae51 10-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed up network stack and drivers for x86_64.

* Various compilation fixes.
* Fixes to the FreeBSD compatibility layer (from comparing the x86-
specific bits with the equivalent amd64 sources in FreeBSD).
* Compile all the Ethernet drivers except for sis900 and wb840, these
require a bit more work to fix (will file a ticket soon). Tested
ipro1000 and rtl81xx, no issues.


# 965abdebd5f3175836079520f618977d2c889407 15-Feb-2010 Axel Dörfler <axeld@pinc-software.de>

* BufferQueue::Free() no longer will return negative values. As is, the max
bytes restriction is only a soft limit. This fixes stalling TCP connections
because everything received would be out of window once this happened.
* Added a TODO to look into TCP's window management - it doesn't seem to be
right.
* Fixed build with tracing turned on.
* Made the fNumber member of tcp_sequence private.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35468 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c21f81c11af8beacf5804d26d62bde44bf2927fe 04-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

bonefish + axeld:
* There was one incorrect check in BufferQueue::Get() that happened because
the wrong operator was used due to the uint32 cast operator.
* Consequently, we removed the uint32 cast operator, and changed the code
to deal with this. Fortunately, no other bugs were observed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29928 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 01b60f3d7ee14299cc8eb68cb4e82b62050cf3a6 20-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* 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


# 93f76bfb7e50a7c5ed85aff643c02158dc5ad393 19-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Turns out the assert was wrong; since the previous buffer can be adjacent to
the next buffer, it can also cause the new buffer to start at the same
sequence as the next buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28958 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0c1404badd90a44ade0e0925ebcd8d0307cae41e 18-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* The check to remove bytes at the beginning happened twice.
* There was an off-by-one error that could well be responsible for bug
#2594. Haven't tested it yet, though.
* Added an extra assert to make sure that "next" is set correctly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28937 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 518720875d78035411e475824ab64c5da1c9c012 11-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed a few more problems that the test application revealed. This should
also close #2594.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28883 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b3cb15e21ee6d6793d23f809db75438fde5d8558 11-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Applied most parts of Adrian's patch in #2594, applied our coding style.
* Cleaned the net_buffer::sequence handling, and fixed a few more problems of
maintaining it in Add().
* Extended Verify() to check everything that's possible, and call it
conditionally on several places, depending on DEBUG_BUFFER_QUEUE. It's turned
on for now which means that any remaining problems should show up when they
happened.
* Call Dump() from TCPEndpoint::Dump().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28878 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0e5a3fc6c685eef140c485b7f3b2cc72030f1e34 08-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* BufferQueue::Get(size_t ...) now always returns successfully if it does not
return an empty buffer. This should avoid losing data in case not everything
could be appended due to a resource shortage.
* Also, it now assures that fNumBytes and fContiguousBytes are always
maintained correctly, thanks to Adrian for pointing this out! This should
fix bug #2594.
* Added extra debug code to BufferQueue::RemoveUntil() so that it checks
whether or not fContiguousBytes could be maintained correctly (ie. if this
function is called only as thought).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28859 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4e9bf24dd5c0e3f434f762c21b8368c9048d7ac8 12-Sep-2008 Michael Lotz <mmlr@mlotz.ch>

CID 26: The status variable was shadowed inside the while loop causing the outer
status to always be B_OK, resulting in an incomplete buffer instead of an error
if the append failed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27469 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1d0b34faae63ccea578c5f8f51038afa16fb825a 23-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* If a new buffer had its last part in common with an existing larger buffer,
BufferQueue::Add() tried to remove a negative amount of bytes. This could
bring a download to a complete halt (as could the other one due to the list
link mixup).
* While the RTT computation still seems to work not that good (with a drop quote
of 50% I would easily reach retransmit timeouts of 80 secs), TCP should now
work a lot better on a flaky connection.
* Renamed _GetMSS() to _MaxSegmentSize().
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22677 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c70d3bafd3ef8cb0b218d942531a2296576a8661 20-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

more TCP fixes, we should now be able to send large amounts of data through congestioned links.

- fixed BufferQueue's RemoveUntil.
- reset SND.NXT on third duplicate ACK (fast retransmit).
- on retransmit reset SND.NXT to SND.UNA (it will be updated back when we get good ACKs).
- fixed effective window calculation.
- relaxed SWS checking a bit, don't send partial packets on retransmission as the window might have been reduced due to congestion.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20769 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a7edede46f377bf9b0f2710079a09f22df2771ca 09-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

fixed multiple TCP issues.

- Moved FIN handling to after Segment Text handling, it matches the RFC and fixes a possible issue with a user missing some final segment data when receiving a FIN.
- Fixed the FIN handling to better terminate connections (no more senseless chatter in the end with RSTs etc).
- When Bind()ing, set the socket address so a call to getsockname() gets the allocated port correctly.
- After reaching the ESTABLISHED state, try to wake all pending threads (still needs work).
- Corrected the maximum amount of time we wait in SendData() to respect socket->send.timeout.
- Now ReadData() behaves correctly in all possible states.
- There was a missing handling of MSG_DONTWAIT, fixed.
- Better internal handling of PSH.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20624 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fcd6d8cd9271e99bd92cf4e0b70efa8c7b984931 04-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

keep PUSH'ed pointer in receiver side of TCP so we can wait for more data in recv()


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20569 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 04121b139607818110601bc9812c59564c4e8a97 15-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

* 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


# af3a31f770fcd8b7e8c5171342cba155bef6dc9e 01-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Calmed down the networking stack a lot - since it basically works, there is no
reason to slow it down with debug output that much; this will also help investigating
some issues where you just aren't interested in most of the output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19672 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6cf91f9542e7ac2cd3feb33ca4ae776413e2c509 04-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

Before freeing "next", it should have been removed already...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19422 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7e85d85e7a254d401e8c60acf3c81208b3787502 30-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* TCPConnection::SendData() now waits until there is enough free space in
the send queue (however, if the buffer sent is larger than the maximum
buffer, it will just hang for now...). The check is also not thread-safe.
* BufferQueue::Get() did not correctly maintain the fFirstSequence member
in remove mode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19403 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 02894e3670b7aac5ae57c6576b9a3e83c24dcf4f 30-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* Reintroduced the accept semaphore: it will be inherited by the new connections
of a LISTEN socket.
* Reading data should now more or less work, too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19401 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 26417177e74510783b4a6f48670c62e96cde0ee2 29-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

More work-in-progress:
* Added some timer methods
* Fixed removing the connection too early (and thus replying with a RST instead of nothing
when the peer acknowledged our FIN).
* BufferQueue::RemoveUntil() did not bump the buffer's sequence
* Delayed acknowledge, and retransmitting should work now (the latter is *very* basic
right now)
* Completed TCPConnection::_ShouldSendSegment()
* fReceiveNext was always updated on a received buffer, even if there was a buffer
missing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19396 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 75dc7cb58a6c6210dd12c07cdad7ba961fb19cd8 28-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* Renamed _SendQueuedData() to _SendQueued(), and made it independent from the
"flags" parameter - this can't be used with retransmitting anyway, and since
the flags are actually fixed per state, the previous solution didn't really
make much sense.
* Made _SendQueued() work a lot more like BSD's tcp_output().
* We can now send even large buffers that need more than one segment at once.
* Added a simple recursive locking mechanism for now - this should be done
differently, though, as we want to have good performance in full duplex mode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19384 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8535905415b70f3516daef470a219d38eafd9097 27-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Some more work-in-progress:
* the TCPConnection::Receive() method is now more or less working as it should;
of course, there are a number of missing things (like round-trip time estimation,
retransmit timers, receive window update, ...).
* reply_with_reset() was broken, and accidently always send the segment it should
answer with reset... (causing an endless loop during connect)
* BufferQueue::RemoveUntil() must always set the fFirstSequence member to the new
sequence, or you will never be able to send anything with that queue (as the
data in it would be no longer contiguous).
* connects, sendings (only single segments), and receiving data is working now
basically (but very incomplete); retransmits or even subsequent transmits (if
the data to be sent doesn't fit in one segment) doesn't work yet, so you better
don't lose any segments :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19378 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1166a4f9b5ac1afc8c89751b2f5158624173cacf 26-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Work-in-progress on TCP:
* Changed the implementation to be more BSD like; state variables are now
the same set as usual.
* The BufferQueue didn't use the initial sequence correctly (problems with
SYN sequence).
* It now also removes data out of the current data set (ie. data that was
already read by the application).
* BufferQueue::Get() also didn't work correctly (the version used by sending
data).
* Fixed various issues around the code like incorrect handling of unexpected
data.
* TCP options don't need the end-of-options marker in case they fill up the
data already, also, the end-of-options marker doesn't need to be padded.
* Options are now only processed during SYN - other options may come
later (timestamps are candidate number one).
* Also broke what was working before: connections do no longer work!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19376 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5fcf044823d5325bd1b6de7c82ef170aaa86439b 25-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* Added a helper class tcp_sequence which hides the semantics of comparing sequences
(this was completely broken in the code before).
* Wrote a buffer queue class to replace the previous algorithm - instead of merging
all buffers together, they're kept in a list, so that the most work will be done
in the application's thread and only very little when the data is received; maybe
we should add an append_move() function to net_buffer, and use that instead,
though, to keep the number of fragments small.
* The advertised receive window is now bound to 65535, the receive window shift
is correctly computed, but not yet used.
* The new buffer queue is now also responsible for the send buffer.
* TCPConnection::ListenReceive() used the wrong address to retrieve the target route.
* Fixed TCPConnection::ReadData() to also return data when the connection is already
closed, and to wait if the connection is not yet established (in SO_NONBLOCK mode);
it still doesn't wait until data is available, though...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19372 a95241bf-73f2-0310-859d-f6bbb57e9c96