mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-05 15:04:30 +02:00
catching socket.timeout using tuple exception #8
This commit is contained in:
parent
b20d140383
commit
0f7ad23e3c
2 changed files with 15 additions and 2 deletions
|
@ -22,13 +22,13 @@ class SocketTransport:
|
|||
"""
|
||||
data = bytearray()
|
||||
while len(data) != length:
|
||||
tmp = None
|
||||
try:
|
||||
tmp = self.sock.recv((length - len(data)))
|
||||
except:
|
||||
raise ConnectionClosed('Socket recv failed.')
|
||||
finally:
|
||||
data += tmp
|
||||
|
||||
data += tmp
|
||||
if not data:
|
||||
raise ConnectionClosed('Connection unexpectedly closed.')
|
||||
return data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue