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

[core] fix m_GroupOf->updateReadState() in message mode #2204

Merged

Conversation

gou4shi1
Copy link
Contributor

@gou4shi1 gou4shi1 commented Dec 7, 2021

Fix #2186 and part of #2046.
I noticed that the return value of ackDataUpTo() is only used to update group readiness, so it should use the last readable seq.
More PRs will be extracted from #2046, base on the new rcv buffer.

@maxsharabayko maxsharabayko added [core] Area: Changes in SRT library core Type: Bug Indicates an unexpected problem or unintended behavior labels Dec 7, 2021
@maxsharabayko maxsharabayko added this to the v1.4.5 milestone Dec 7, 2021
@maxsharabayko
Copy link
Collaborator

@gou4shi1 Thanks for the PR!

Looks like the return value of the CUDT::ackDataUpTo(..) in the case of the old receiver buffer would be different, It returns the sequence number of the first packet available for reading.
While with the new receiver buffer the function returns the sequence number of the latest packet available for reading. This is the correct behavior, as the group needs the value to update its read-ready state.

P.S. Added description comments to related functions:
comments.patch.zip

@maxsharabayko maxsharabayko self-requested a review December 7, 2021 11:15
@gou4shi1
Copy link
Contributor Author

gou4shi1 commented Dec 7, 2021

Looks like the return value of the CUDT::ackDataUpTo(..) in the case of the old receiver buffer would be different, It returns the sequence number of the first packet available for reading.

Yes, the behavior with old recv buffer is not correct, when will the old recv buffer be deleted?

Added description comments to related functions:

Thanks, I have applied your patch in this PR :)

@gou4shi1 gou4shi1 force-pushed the fix-group-recv-in-message-mode-part-1 branch from cd08fd9 to b2cd1dc Compare December 7, 2021 14:22
@maxsharabayko
Copy link
Collaborator

when will the old recv buffer be deleted?

It might stay in the next release to have a fallback option in case of unexpected issues. And can be removed afterwards.

@maxsharabayko
Copy link
Collaborator

While the old receiver buffer is being supported, better to have it also functioning correctly.
Here is a proposed fix of the CUDT::ackDataUpTo(..) function with respect to the old receiver buffer. The function should now behave almost similarly both with the new, and with the old receiver buffer. At least return the latest readable seqno, not the first one.

int32_t srt::CUDT::ackDataUpTo(int32_t ack)
{
    // ...
#else
    if (acksize > 0)
    {
        m_pRcvBuffer->ackData(acksize);
    }

    return ack;
#endif
}

@gou4shi1
Copy link
Contributor Author

gou4shi1 commented Dec 8, 2021

Here is a proposed fix

It's similar as #2186, applied :)

At least return the latest readable seqno, not the first one.

Actually "maybe readable" for messages across multiple packets (with old rcv buffer), right?

@maxsharabayko
Copy link
Collaborator

Here is a proposed fix

It's similar as #2186, applied :)

When three independent solutions come to a single (similar) one, it confirms the solution must be correct 🙂

At least return the latest readable seqno, not the first one.

Actually "maybe readable" for messages across multiple packets (with old rcv buffer), right?

Hopefully readable 🙂

@gou4shi1
Copy link
Contributor Author

gou4shi1 commented Dec 8, 2021

When three independent solutions come to a single (similar) one, it confirms the solution must be correct slightly_smiling_face

LOL

@gou4shi1 gou4shi1 changed the title [core] fix m_GroupOf->updateReadState() with new rcv buffer [core] fix m_GroupOf->updateReadState() in message mode Dec 8, 2021
@maxsharabayko maxsharabayko merged commit c8cb38f into Haivision:master Dec 8, 2021
@gou4shi1 gou4shi1 deleted the fix-group-recv-in-message-mode-part-1 branch December 8, 2021 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[core] Area: Changes in SRT library core Type: Bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants