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 deadlock on connection lost #24

Merged
merged 1 commit into from
Nov 3, 2021
Merged

Conversation

MB512
Copy link
Contributor

@MB512 MB512 commented Sep 16, 2021

When connection is lost after the command was send there was no possibility to dispose the Device.

This fix uses a timeout in the WaitOne call and checks the Cancellation token. Additionally it notifies all commands that they are finished (with null response).

This makes it possible to dispose a Device if a command was send but the connection is lost before the response is received.

@DarthAffe
Copy link
Owner

Oh that's a great find - I was seeing issues with capturing data getting stuck myself from time to time, but could never really track it down

@MB512
Copy link
Contributor Author

MB512 commented Sep 23, 2021

Thanks! I just want to add that this just adds the possibility to dispose the Device in this case. One could add a CommandTimeout property and handle it at the same location, but I didn't want to change to much.

I am using this by starting a watchdog timer with every command send to the Device, stopping it after the command finished and when fired I dispose the Device and recreate it.

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.

None yet

2 participants