forked from M-Labs/thermostat
Only set connecting task to None once
This commit is contained in:
parent
8520dae93b
commit
1226cca6e6
|
@ -27,7 +27,8 @@ class Client:
|
||||||
self._reader, self._writer = await self._connecting_task
|
self._reader, self._writer = await self._connecting_task
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
return False
|
return False
|
||||||
self._connecting_task = None
|
finally:
|
||||||
|
self._connecting_task = None
|
||||||
|
|
||||||
await self._check_zero_limits()
|
await self._check_zero_limits()
|
||||||
return True
|
return True
|
||||||
|
@ -44,7 +45,6 @@ class Client:
|
||||||
"""Disconnect the client if connected, cancel connection if connecting"""
|
"""Disconnect the client if connected, cancel connection if connecting"""
|
||||||
if self._connecting_task is not None:
|
if self._connecting_task is not None:
|
||||||
self._connecting_task.cancel()
|
self._connecting_task.cancel()
|
||||||
self._connecting_task = None
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if self._writer is None:
|
if self._writer is None:
|
||||||
|
|
Loading…
Reference in New Issue