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: recvuntil #91

Open
JonathanBeverley opened this issue Jan 30, 2018 · 2 comments
Open

Bug: recvuntil #91

JonathanBeverley opened this issue Jan 30, 2018 · 2 comments
Labels

Comments

@JonathanBeverley
Copy link
Contributor

Tube::recvuntil optionally takes a timeout. If provided, it enters a loop like

while @timer.active?
  s = recv(1)
  return '' if s.empty?
  # process s
end

However, that return bails out of the whole function, not the @Timer loop. Should be next if s.empty?

@JonathanBeverley
Copy link
Contributor Author

Also affects Timer::recvpred

@peter50216
Copy link
Owner

The original design for the timer / tube things is that we assume that after setting timeout_raw, recv_raw would either:

  • Return some data in at most timeout_raw seconds.
  • Return empty string if no data is available in timeout_raw seconds.
  • Raise EOFError.

So we somewhat assume that recv_raw is a blocking call.

We should definitely document this better (and fix the outdated document after #87), and maybe also provide a fallback implementation for non-blocking recv_raw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants