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

[BUG] srt_recv in file/message mode does not set SRT_ELARGEMSG when buffer is too small #2734

Open
markniebur opened this issue May 9, 2023 · 1 comment · May be fixed by #2809
Open

[BUG] srt_recv in file/message mode does not set SRT_ELARGEMSG when buffer is too small #2734

markniebur opened this issue May 9, 2023 · 1 comment · May be fixed by #2809
Labels
Type: Bug Indicates an unexpected problem or unintended behavior

Comments

@markniebur
Copy link

Describe the bug
According to the docs, when a connection has been made in file/message mode, srt_recv should return SRT_ERROR and set SRT_ELARGEMSG when a message will not entirely fit in the provided buffer.

To Reproduce
Steps to reproduce the behavior:

  1. Create connection in file/message mode.
  2. Send large message to receiver
  3. Call srt_recv with a buffer too small to contain the entire message.
  4. Verify SRT_ERROR is not returned.

Expected behavior
SRT_ERROR should be returned and SRT_ELARGEMSG should be returned from srt_getlasterror.

Additional context
Additionally, the table entry for SRT_ELARGEMSG under srt_recv mentions the sending buffer, although that's not relevant for receiving.

@markniebur markniebur added the Type: Bug Indicates an unexpected problem or unintended behavior label May 9, 2023
@ethouris
Copy link
Collaborator

ethouris commented Oct 9, 2023

Small update about the current state:

  1. The documentation is definitely incorrect:
    • This is only mentioned by the description of SRT_ELARGEMSG, but nothing like this is mentioned by the srt_recvmsg description
    • The description for SRT_ELARGEMSG is mentioned by srt_recvmsg, but it is likely copied from the one for srt_sendmsg as the text is identical and doesn't make any sense there
  2. The current state is kinda unstable, even if it is consistent with system UDP approach (and likely also used in SCTP), but also not perfectly - UDP/SCTP use recvmsg function to receive the message and when the buffer is too small, the MSG_TRUNC is set on the flags on return. A similar thing could be also implemented for srt_recvmsg2 for consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants