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

Fixing server's alignment of HTTP "chunks" with ICY blocks #718

Merged
merged 1 commit into from Dec 27, 2021

Conversation

philippe44
Copy link
Contributor

@philippe44 philippe44 commented Dec 27, 2021

Needs more test probably but that fixes the case when streaming server send TCP blocks that are aligned with the 1st byte of ICY metadata. In such case, LMS enters a busy loop inside it's S::P::P::HTTP.pm::sysread and the server might not send the next block before a while. Such busy loop will eat CPU.

With that PR, the readMetaData is made at the beginning of sysread so that, if the previous sysread ended just before the ICY byte, then the current one will start by reading the ICY length (one byte) and if this "fails" (i.e. EWOUDLBLOCK/EAGAIN) then we exit and let the "busy loop" to be handled by the sysread caller (i.e. the event loop) which does not hammer the system, as we would not with a "readChunk"

@michaelherger
Copy link
Member

LGTM - I'm glad you know the streaming code so well by now 😀. Thanks a lot!

@mherger mherger merged commit 8306c5d into LMS-Community:public/8.3 Dec 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants