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 for "disconnect" command execution when connection to device is interrupted #963

Merged
merged 4 commits into from
Mar 25, 2020

Conversation

dvksirin
Copy link
Contributor

@dvksirin dvksirin commented Mar 24, 2020

Executing "disconnect" command fails if device connection was interrupted.
It could be reproduced in a way described in #958

  1. Connect to an AP
  2. Turn off AP (remove power)
  3. Disconnect from AP (fails)
  4. Connect to AP or any other device (fails due to "already connected")

This PR fixes this issue.

The fix is simple:

     -   self._loop.run_coroutine(self.adapter.disconnect(0))
     +   if not self.connection_interrupted:
     +       self._loop.run_coroutine(self.adapter.disconnect(0))

If self.connection_interrupted if set to True then it means that all necessary routines triggered by the call self.adapter.disconnect(0) are already executed when "disconnect" event (device connection got interrupted) was handled.

Closes #958

@dvksirin dvksirin changed the title Fix for "disconnect" command when connection to device is interrupted Fix for "disconnect" command execution when connection to device is interrupted Mar 24, 2020
@dvksirin dvksirin merged commit dcf7c76 into master Mar 25, 2020
DimaWittmann pushed a commit that referenced this pull request Apr 29, 2020
…nterrupted (#963)

* check if cannection is interrupted while executing "disconnect" command
* update macOS version for vmImage in azure-pipelines.yml
* update RELEASE.md: increment version number
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.

cannot connect after disconnect failure
2 participants