Commit b2b1d6e5 authored by Jim Fulton's avatar Jim Fulton

saneify ClientStorage/asyncio wait api

parent ae4d9496
...@@ -266,13 +266,16 @@ class ClientStorage(object): ...@@ -266,13 +266,16 @@ class ClientStorage(object):
self._call = self._server.call self._call = self._server.call
self._async = self._server.async self._async = self._server.async
self._async_iter = self._server.async_iter self._async_iter = self._server.async_iter
self._wait = self._server.wait
self._commit_lock = threading.Lock() self._commit_lock = threading.Lock()
if wait:
try: try:
self._server.start(wait=wait) self._wait()
except Exception: except Exception:
# No point in keeping the server going of the storage creation fails # No point in keeping the server going of the storage
# creation fails
self._server.close() self._server.close()
raise raise
......
...@@ -805,9 +805,10 @@ class ClientThread(ClientRunner): ...@@ -805,9 +805,10 @@ class ClientThread(ClientRunner):
loop.close() loop.close()
logger.debug('Stopping client thread') logger.debug('Stopping client thread')
def start(self, wait=True): def wait(self, timeout=None):
if wait: if timeout is None:
self.wait_for_result(self.client.connected, self.timeout) timeout = self.timeout
self.wait_for_result(self.client.connected, timeout)
closed = False closed = False
def close(self): def close(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment