diff options
author | Betty Zhou <bettyzhou@google.com> | 2017-02-22 12:13:17 -0800 |
---|---|---|
committer | Betty Zhou <bettyzhou@google.com> | 2017-02-22 12:13:17 -0800 |
commit | 8c5610fe9b1e93031ed1151f8aec09effe9f7225 (patch) | |
tree | e63b277faef4441ec4e68849f01bfb6ed99c5f57 | |
parent | 150d32fdbf0d6e491cf7fdca9361861c088e5c63 (diff) | |
download | platform_tools_test_connectivity-8c5610fe9b1e93031ed1151f8aec09effe9f7225.tar.gz platform_tools_test_connectivity-8c5610fe9b1e93031ed1151f8aec09effe9f7225.tar.bz2 platform_tools_test_connectivity-8c5610fe9b1e93031ed1151f8aec09effe9f7225.zip |
Fix the undefined timeout in _rpc method.
Test: run test in the lab.
Bug: 35408415
Change-Id: Ib8f503ee04b2ac9a532865d54dff916cc28722c6
-rw-r--r-- | acts/framework/acts/controllers/sl4a_client.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/acts/framework/acts/controllers/sl4a_client.py b/acts/framework/acts/controllers/sl4a_client.py index bf08e52e15..ac3fbf4de6 100644 --- a/acts/framework/acts/controllers/sl4a_client.py +++ b/acts/framework/acts/controllers/sl4a_client.py @@ -309,7 +309,7 @@ class Sl4aClient(object): Args: method: str, The name of the method to execute. args: any, The args to send to sl4a. - timeout: timeout for the RPC call. + kwargs: timeout: timeout for the RPC call. Returns: The result of the rpc. @@ -318,12 +318,11 @@ class Sl4aClient(object): Sl4aProtocolError: Something went wrong with the sl4a protocol. Sl4aApiError: The rpc went through, however executed with errors. """ + timeout = kwargs.get("timeout") with self._lock: apiid = next(self._counter) - if kwargs.get("timeout"): + if timeout: self.conn.settimeout(timeout) - else: - self.conn.settimeout(self._SOCKET_TIMEOUT) data = {'id': apiid, 'method': method, 'params': args} request = json.dumps(data) self.client.write(request.encode("utf8") + b'\n') @@ -332,7 +331,7 @@ class Sl4aClient(object): if not response: raise Sl4aProtocolError(Sl4aProtocolError.NO_RESPONSE_FROM_SERVER) result = json.loads(str(response, encoding="utf8")) - if kwargs.get("timeout"): + if timeout: self.conn.settimeout(self._SOCKET_TIMEOUT) if result['error']: raise Sl4aApiError("RPC call %s failed with error %s" % |