Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate a potential bug #98

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Eliminate a potential bug #98

wants to merge 1 commit into from

Conversation

kingysu
Copy link
Contributor

@kingysu kingysu commented Aug 13, 2024

If we send an event here, we may enter a new event loop and then the new event loop will process the events including socket events. As a result, after exiting the new event loop, the activeNotifierPos is same as the src->pollfds.count() and activeNotifierPos will be added by one in the old event loop.

So there is a potential situation that activeNotifierPos will overflow if we have too many sockets and nested event loops.

Although this situation is almost impossible, we can improve the code by little effort. That's it.

If we send an event here, we may enter a new event loop and then
the new event loop will process the events including socket events.
As a result, after exiting the new event loop, the activeNotifierPos
is same as the src->pollfds.count() and activeNotifierPos will be
added by one in the old event loop.

So there is a potential situation that activeNotifierPos will overflow
if we have too many sockets and nested event loops.

Although this situation is almost impossible, we can improve the code
by little effort. That's it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant