[En-Nut-Discussion] TCP statemachine fixes for unreliable connections
ole.reinhardt at embedded-it.de
Sun Jan 24 21:05:45 CET 2016
I just checked in some important fixes to svn trunk. It might be worth
to backport these changes to our previous release branches as well.
r6284 fixes a bug, introduced in r2771 (6 years ago). Some network
buffer status variables was accessed after freeing the network buffer.
The affected code keeps track of the tcp packages received in advance
and implements a global buffer limit. In best case, the bug could lead
to tcp packages being dropped unnecessary, in worst case, invalid memory
regions (out of address space) could be accessed, resulting in crashes.
The fix helps to make the tcp recovery on unreliable tcp connections faster.
This patch makes the limit for tcp packets beeing received in advance
configurable. It adds a new option TCP_ADV_MAX to the net/tcp section in
Up to now, a global limit of 3216 bytes, which is the default window
size (6 x 536 bytes), had been implemented. This was a global limit,
which limits the amount of all tcp packages beeing received in advance
(sum on all currently connected tcp sockets).
The default setting of TCP_ADV_MAX is exactly the old value, to keep
It turned out, that the limit was too low for streaming audio
applications, especially if the tcp receive buffer was increased by the
application. In this cases the recovery on unreliable tcp connections
caused lots of package re-sends.
In my eyes, implementing a global limit is not the best implementation
and only usefull on systems with very low memory. The higher this limit
is set, the faster tcp connections will recover after package lost.
You can even disable this limit completely, by setting it to 0.
Alter Weg 3
More information about the En-Nut-Discussion