| Index: client/utils/tools.py
|
| diff --git a/client/utils/tools.py b/client/utils/tools.py
|
| index ab9a492c921f6226168d4db2da99ef2fe715b8fe..823ae51e111fc06a6073f97ed03c7774fcf0827a 100644
|
| --- a/client/utils/tools.py
|
| +++ b/client/utils/tools.py
|
| @@ -316,3 +316,14 @@ def get_cacerts_bundle():
|
| # to current directory instead. We use our own bundled copy of cacert.pem.
|
| _ca_certs = zip_package.extract_resource(utils, 'cacert.pem', temp_dir='.')
|
| return _ca_certs
|
| +
|
| +
|
| +def sliding_timeout(timeout):
|
| + """Returns a function that returns how much time left till (now+timeout).
|
| +
|
| + If timeout is None, the returned function always returns None.
|
| + """
|
| + if timeout is None:
|
| + return lambda: None
|
| + deadline = time.time() + timeout
|
| + return lambda: deadline - time.time()
|
|
|