mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 21:34:07 +08:00
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 <wengzhe@xiaomi.com>
This commit is contained in:
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user