Commit b2b1d6e5 authored by Jim Fulton's avatar Jim Fulton

saneify ClientStorage/asyncio wait api

parent ae4d9496
...@@ -266,15 +266,18 @@ class ClientStorage(object): ...@@ -266,15 +266,18 @@ 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()
try: if wait:
self._server.start(wait=wait) try:
except Exception: self._wait()
# No point in keeping the server going of the storage creation fails except Exception:
self._server.close() # No point in keeping the server going of the storage
raise # creation fails
self._server.close()
raise
def new_addr(self, addr): def new_addr(self, addr):
self._addr = addr self._addr = addr
......
...@@ -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