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

Problems with recvAll in Network.Socket contrib Library #4868

Open
FrederikVigen opened this issue Jun 6, 2020 · 1 comment
Open

Problems with recvAll in Network.Socket contrib Library #4868

FrederikVigen opened this issue Jun 6, 2020 · 1 comment

Comments

@FrederikVigen
Copy link
Contributor

We have tried to use the recvAll functionality in the Network.Socket library from the contrib package.
It seems that when it runs recursively into the recv on an empty buffer, it is blocking and not receiving the clean exit (Left 0) signal, thus running infinitely and never returning.
We propose a solution to this issue that instead of waiting for a Left 0 signal, the function runs recursively until then buffer size is smaller than the reading size that it is trying to achieve. The solution looks something like this: https://pastebin.com/vZx6YxNh
We would like to know if you have any problems with the iteration of the code that we have done, or for that matter if you have any idea of improvement.

The exact code that this revision relates to is: https://github.com/idris-lang/Idris-dev/blob/master/libs/contrib/Network/Socket.idr

@melted
Copy link
Contributor

melted commented Jun 6, 2020

Hi! I think it's a great improvement. Please submit a PR.

If you want to you can see if the same fix applies to Idris 2: https://github.com/idris-lang/Idris2.

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

No branches or pull requests

2 participants