This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 34ade7a0b6 net/devif: fix devif_poll loop logic 34ade7a0b6 is described below commit 34ade7a0b64a59db7529b3d785228d4a89d7dbe0 Author: Zhe Weng <weng...@xiaomi.com> AuthorDate: Fri Dec 30 15:01:26 2022 +0800 net/devif: fix devif_poll loop logic Previously, the devif_poll works in this flow: devif_poll_xx -> bstop = callback -> continue if !bstop -> poll another Now we split the polling and callback, so it should work like: devif_poll_connections -> return true if callback need to be called -> bstop = callback -> loop if !bstop -> poll again Conditions: poll_connections == 0, d_len == 0, break, return 0 poll_connections == 1, d_len == 0, break, return 1 (other stop case, don't callback) poll_connections == 1, d_len > 0, callback == 1, break, return 1 poll_connections == 1, d_len > 0, callback == 0, loop Signed-off-by: Zhe Weng <weng...@xiaomi.com> --- net/devif/devif_poll.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/devif/devif_poll.c b/net/devif/devif_poll.c index 89567a187a..4b77fbe218 100644 --- a/net/devif/devif_poll.c +++ b/net/devif/devif_poll.c @@ -964,8 +964,14 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback) } } } + else + { + /* Not stopped by devif_poll_callback, just stop and return bstop */ + + break; + } } - while (bstop); + while (!bstop); /* Device polling completed, release iob */