Commit b2b1d6e5 authored by Jim Fulton's avatar Jim Fulton

saneify ClientStorage/asyncio wait api

parent ae4d9496
......@@ -266,15 +266,18 @@ class ClientStorage(object):
self._call = self._server.call
self._async = self._server.async
self._async_iter = self._server.async_iter
self._wait = self._server.wait
self._commit_lock = threading.Lock()
try:
self._server.start(wait=wait)
except Exception:
# No point in keeping the server going of the storage creation fails
self._server.close()
raise
if wait:
try:
self._wait()
except Exception:
# No point in keeping the server going of the storage
# creation fails
self._server.close()
raise
def new_addr(self, addr):
self._addr = addr
......
......@@ -805,9 +805,10 @@ class ClientThread(ClientRunner):
loop.close()
logger.debug('Stopping client thread')
def start(self, wait=True):
if wait:
self.wait_for_result(self.client.connected, self.timeout)
def wait(self, timeout=None):
if timeout is None:
timeout = self.timeout
self.wait_for_result(self.client.connected, timeout)
closed = False
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