forked from M-Labs/thermostat
Add timeout to connect call
This commit is contained in:
parent
efa814a0d3
commit
d52aafd7f6
|
@ -23,7 +23,7 @@ class Client:
|
||||||
if connected:
|
if connected:
|
||||||
return
|
return
|
||||||
"""
|
"""
|
||||||
self._connecting_task = asyncio.create_task(asyncio.open_connection(host, port))
|
self._connecting_task = asyncio.create_task(asyncio.wait_for(asyncio.open_connection(host, port), timeout))
|
||||||
try:
|
try:
|
||||||
self._reader, self._writer = await self._connecting_task
|
self._reader, self._writer = await self._connecting_task
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
|
|
Loading…
Reference in New Issue