fjpanag opened a new pull request, #7278: URL: https://github.com/apache/incubator-nuttx/pull/7278
## Summary The function `recvfrom` for TPC operates in two stages: first it reads any available data in the read-ahead buffer, and then blocks waiting for the rest of the data. The offending line here caused the `recvfrom` to return *less* data than the requested amount, which is wrong. Two cases exist: If the socket is in blocking mode, it can read from the read-ahead buffer, but it should also wait for the specified time till all data have been received. If the socket is in non-blocking mode, then it should return only what is available in the read-ahead buffers, and not wait (block). (This is correctly handled by an `if` case above). Essentially, the socket was always behaving as if it was set in non-blocking mode. This PR fixes this, making the socket to actually respect the time-out, and return the correct data size. ## Impact TPC should behave better now, but I don't expect any impact on existing applications. If some code was working correctly with the bug in place, then I guess it will continue to work correctly. ## Testing This is tested on a proprietary server on an STM32F4 board. Before the fix, it was impossible for the clients to correctly communicate with the server. After the fix, all communication seem very stable (at least in regard to this aspect of TCP). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org