After some further checking, we found a solution to the problem that Tamás reports here above, the starvation of lower-priority tasks.
Please change the following static-inline function in include/FreeRTOSIP
static portINLINE UBaseTypet uxGetRxEventCount( void )
– extern volatile UBaseType
– return uxRxEventCount;
+ return 0u;
In other words, let this function always return zero.
When +TCP was first developed, we thought it would be advantageous to constantly keep track of how many RX packets are queued-up for the IP-task. It would allow the IP-task to give priority to RX processing above sending TCP packets.
The internal variable
would keep track of the number of RX packets queued in
The starvation: as long as
was non-zero, the IP-task wouldn’t block.
in FreeRTOS_Socket.c would return 0 ticks:
if( uxGetRxEventCount() != 0u )
/* This was interrupted, but want to be called as soon as
possible to finish checking the other sockets. * /
xShortest = ( TickType_t ) 0;
The above code is not needed at all: as long as the
is non-empty, the IP-task won’t block unless another task has work to do at a higher priority.
In the latest release of +TCP, you will see in
won’t be checked any more. That was thanks to Andrzej Burski, who noted that under some circumstances, the IP-task just stops sending TCP packets.
Tamás, thanks for reporting the above. In the next release, I think that
will have disappeared altogether 🙂