mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
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:
committed by
Alin Jerpelea
parent
0b69731a97
commit
a7926405ca
@@ -75,13 +75,13 @@ static uint16_t udp_datahandler(FAR struct net_driver_s *dev,
|
|||||||
uint8_t offset = 0;
|
uint8_t offset = 0;
|
||||||
|
|
||||||
#if CONFIG_NET_RECV_BUFSIZE > 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);
|
netdev_iob_release(dev);
|
||||||
iob_free_chain(iob);
|
|
||||||
#ifdef CONFIG_NET_STATISTICS
|
#ifdef CONFIG_NET_STATISTICS
|
||||||
g_netstats.udp.drop++;
|
g_netstats.udp.drop++;
|
||||||
#endif
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user