Commit f2e350a7 by rfkelly0

more pessimistic locking for ConnectionManagerFS

parent 359377ac
......@@ -195,12 +195,14 @@ class ConnectionManagerFS(WrapFS):
def wait_for_connection(self,timeout=None):
self._connection_cond.acquire()
try:
if not self.connected:
if not self._poll_thread:
target = self._poll_connection
self._poll_thread=threading.Thread(target=target)
self._poll_thread = threading.Thread(target=target)
self._poll_thread.start()
self._connection_cond.wait(timeout)
finally:
self._connection_cond.release()
def _poll_connection(self):
......@@ -210,15 +212,16 @@ class ConnectionManagerFS(WrapFS):
except RemoteConnectionError:
self._poll_sleeper.wait(self.poll_interval)
self._poll_sleeper.clear()
continue
except FSError:
break
else:
break
self._connection_cond.acquire()
try:
self.connected = True
self._poll_thread = None
self._connection_cond.notifyAll()
finally:
self._connection_cond.release()
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