Wed 19 Jul 2017 10:18:01 AM UTC, original submission:
select and sock->rcvevent
With receive of each data portion will be
recv_tcp() callback function called.
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len) is expanded to event_callback()
and hier will be following code executed:
sock->rcvevent++;
It doesn't matter how many data is received:
NETCONN_EVT_RCVPLUS -> sock->rcvevent++
NETCONN_EVT_RCVMINUS -> sock->rcvevent--
The comment in lwip_selscan "/* ... then examine it: */"
say that code should be reworked
lwip_selscan() code has patch trying to fix this behaviour -
it is checked not only rcvevent, but lastdata too:
((lastdata != NULL) || (sock->rcvevent > 0))
Error scenario:
100 times 1-byte packet recieved:
sock->rcvevent is 100,
recv() to receive 100 bytes called:
100 bytes received
sock->rcvevent is 99,
select after that returns 99 times readset active, but socket has no data and recv() returns EWOULDBLOCK
It is not correct.
After recv() sock->rcvevent should be 0
|