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

Can cause infinite loop in caller code #62

Closed
Ekstazi opened this issue Jun 14, 2019 · 2 comments
Closed

Can cause infinite loop in caller code #62

Ekstazi opened this issue Jun 14, 2019 · 2 comments

Comments

@Ekstazi
Copy link

Ekstazi commented Jun 14, 2019

return new Success; // Resolve with null on closed stream.

In some rare cases if caller code doesn't check for null this may cause infinite loop and amp loop will not work.

Need to use immediateWatcher instead. This may also affects output stream.

Also see related ticket:
amphp/ssh#16

@kelunik
Copy link
Member

kelunik commented Jun 14, 2019

I think an infinite loop here is better, because it makes you aware of that coding error. Using an immediate watcher just hides the problem.

@kelunik
Copy link
Member

kelunik commented Jul 25, 2019

I don't think we can do anything here to improve the situation without breaking the interface. I think the best thing to do would be throwing an exception if read() is called repeatedly and returned null before.

@kelunik kelunik closed this as completed Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants