net/udp: Fix the bug of overwriting when the udp recv buffer is full

Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
This commit is contained in:
wangyingdong 2023-06-08 10:50:53 +08:00 committed by Alin Jerpelea
parent 0b69731a97
commit a7926405ca
1 changed files with 3 additions and 3 deletions

View File

@ -75,13 +75,13 @@ static uint16_t udp_datahandler(FAR struct net_driver_s *dev,
uint8_t offset = 0;
#if CONFIG_NET_RECV_BUFSIZE > 0
while (iob_get_queue_size(&conn->readahead) > conn->rcvbufs)
if (iob_get_queue_size(&conn->readahead) > conn->rcvbufs)
{
iob = iob_remove_queue(&conn->readahead);
iob_free_chain(iob);
netdev_iob_release(dev);
#ifdef CONFIG_NET_STATISTICS
g_netstats.udp.drop++;
#endif
return 0;
}
#endif