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

Fix PeekNamedPipe Method #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix PeekNamedPipe Method #23

wants to merge 1 commit into from

Conversation

Fropops
Copy link

@Fropops Fropops commented Jul 27, 2023

The current use of PeekNamedPipe does not work properly.
As the result of the API call to PeekNamedPipe only indicates whether the call is successful but does not provide any information about the availability of data.
In the Drone program, the thread is then blocked on the "pipe.ReadStream()", preventing the loop to operate.

I changed it to effectively check the number of bytes available.
Also, I added a throw when the call is not succeeding which will enable to properly close the communicator using the OnException event (I think it was already working because the pipe.ReadStream throws an exception when the pipe is closed).

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.

1 participant