Skip to content

Commit

Permalink
Merge 8b5b646 into e83bcba
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLIrion committed Nov 14, 2019
2 parents e83bcba + 8b5b646 commit 677f945
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions androidtv/adb_manager.py
Expand Up @@ -116,15 +116,15 @@ def connect(self, always_log_errors=True, auth_timeout_s=DEFAULT_AUTH_TIMEOUT_S)
_LOGGER.warning("Couldn't connect to host %s. %s: %s", self.host, exc.__class__.__name__, exc.strerror)

# ADB connection attempt failed
self._adb.close()
self.close()
self._available = False

except Exception as exc: # pylint: disable=broad-except
if self._available or always_log_errors:
_LOGGER.warning("Couldn't connect to host %s. %s: %s", self.host, exc.__class__.__name__, exc)

# ADB connection attempt failed
self._adb.close()
self.close()
self._available = False

finally:
Expand All @@ -134,6 +134,8 @@ def connect(self, always_log_errors=True, auth_timeout_s=DEFAULT_AUTH_TIMEOUT_S)
self._adb_lock.release()

# Lock could not be acquired
_LOGGER.warning("Couldn't connect to host %s because adb-shell lock not acquired.", self.host)
self.close()
self._available = False
return False

Expand Down Expand Up @@ -163,7 +165,7 @@ def shell(self, cmd):
self._adb_lock.release()

# Lock could not be acquired
_LOGGER.debug("ADB command not sent to %s because adb-shell lock not acquired: %s", self.host, cmd)
_LOGGER.warning("ADB command not sent to %s because adb-shell lock not acquired: %s", self.host, cmd)
return None


Expand Down Expand Up @@ -291,6 +293,8 @@ def connect(self, always_log_errors=True):
self._adb_lock.release()

# Lock could not be acquired
_LOGGER.warning("Couldn't connect to host %s via ADB server %s:%s because pure-python-adb lock not acquired.", self.host, self.adb_server_ip, self.adb_server_port)
self.close()
self._available = False
return False

Expand Down Expand Up @@ -320,5 +324,5 @@ def shell(self, cmd):
self._adb_lock.release()

# Lock could not be acquired
_LOGGER.debug("ADB command not sent to %s via ADB server %s:%s because pure-python-adb lock not acquired: %s", self.host, self.adb_server_ip, self.adb_server_port, cmd)
_LOGGER.warning("ADB command not sent to %s via ADB server %s:%s because pure-python-adb lock not acquired: %s", self.host, self.adb_server_ip, self.adb_server_port, cmd)
return None

0 comments on commit 677f945

Please sign in to comment.