[core] Fix incorrectly updated epoll flags in case of group accept #3181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The previous fix for the pending groups was done incorrectly. The problem is that even if the group is pending, it should still keep the UPDATE state on every listener that provided FURTHER group member sockets.
Instead of the
m_bPending
flag, now it's providing the group with the list of listener sockets which at the moment have any pending member sockets that are members of this group. This way every single listener socket is set the UPDATE flag if it contained any second and next sockets pending for this group.The situation is happening in case when you have multiple connections reporting at once and all of them for a moment remain the pending sockets. In this case every single listener socket that provided the socket for this group should keep it queued and report read-ready state (no matter that only one of them can effectively deliver the group). Once the
srt_accept
is called for any of the listeners that reported it, the first found group member socket is extracted from the queue, but the reported socket is replaced with the group ID. This time however all listener sockets are reviewed to check if any of them have more queued sockets and:IMPORTANT: The very first listener that gets the reported-in connection for a group, as it CREATES the mirror group at the listener side, adds this listener to the pending listeners in the group. Any next such connection request adds the listener to this list ONLY IF AT LEAST ONE SOCKET IS THERE ALREADY (otherwise it means that the group wasn't pending and the socket is not queued). After the call to accept, this list is cleared.