Thu 14 Jan 2010 11:21:30 AM UTC, original submission:
When doing netconn_write, the codeflow goes through do_write, do_writemore, tcp_write, tcp_enqueue.
tcp_enqueue checks for the queuelen to be smaller than TCP_SND_QUEUELEN and returns ERR_MEM if it is bigger.
BUT tcp_write() does not care with a comment stating that this is a temporary error.
That is correct when tcp_output() is able to send stuff but without incoming ACKs this might take forever which will block netconn_write() forever.
This can be fixed by early checking of TCP_SND_QUEUELEN and signalling that it will be reached by the next write.
This should also make the socket_select() a little less bumpy
In api_msg.c, function do_writemore(), line 1015:
...
if ((err == ERR_OK) && ((tcp_sndbuf(conn->pcb.tcp) <= TCP_SNDLOWAT) || ((tcp_sndqlen(conn->pcb.tcp) + 1 >= TCP_SND_QUEUELEN)))) {
API_EVENT(conn, NETCONN_EVT_SENDMINUS, len);
}
...
and in tcp.h, line 80/81:
...
#define tcp_sndqlen(pcb) ((pcb)->snd_queuelen)
...
Sorry I can't produce an ordinary diff/patch right now, but it's only two lines change.
--
PS: the lwip version field in the savannah Bug reporter misses Version 1.3.2
|