udp: Don't accumulate the receive length in psock_udp_recvfrom
since udp_recvfrom_newdata is called no more than once
@@ -71,34 +71,6 @@ struct udp_recvfrom_s
* Private Functions
****************************************************************************/
-/****************************************************************************
- * Name: udp_update_recvlen
- *
- * Description:
- * Update information about space available for new data and update size
- * of data in buffer, This logic accounts for the case where
- * udp_readahead() sets state.ir_recvlen == -1 .
- *
- * Input Parameters:
- * pstate recvfrom state structure
- * recvlen size of new data appended to buffer
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-static inline void udp_update_recvlen(FAR struct udp_recvfrom_s *pstate,
- size_t recvlen)
-{
- if (pstate->ir_recvlen < 0)
- {
- pstate->ir_recvlen = 0;
- }
-
- pstate->ir_recvlen += recvlen;
-}
-
static void udp_recvpktinfo(FAR struct udp_recvfrom_s *pstate,
FAR void *srcaddr, uint8_t ifindex)
{
@@ -194,12 +166,11 @@ static size_t udp_recvfrom_newdata(FAR struct net_driver_s *dev,
/* Copy the new appdata into the user buffer */
memcpy(pstate->ir_msg->msg_iov->iov_base, dev->d_appdata, recvlen);
- ninfo("Received %d bytes (of %d)\n", (int)recvlen, (int)dev->d_len);
+ ninfo("Received %zu bytes (of %" PRIu16 ")\n", recvlen, dev->d_len);
- /* Update the accumulated size of the data read */
-
- udp_update_recvlen(pstate, recvlen);
+ /* Update the size of the data read */
+ pstate->ir_recvlen = recvlen;
return recvlen;
}
