mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 03:33:35 +00:00
Ignore OSError on socket.shutdown()
This fixes #22 and obsoletes PR #23.
This commit is contained in:
parent
72cbaa2839
commit
9d3fbfa975
@ -63,8 +63,14 @@ class TPLinkSmartHomeProtocol:
|
|||||||
break
|
break
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
sock.shutdown(socket.SHUT_RDWR)
|
try:
|
||||||
sock.close()
|
sock.shutdown(socket.SHUT_RDWR)
|
||||||
|
sock.close()
|
||||||
|
except OSError:
|
||||||
|
# OSX raises OSError when shutdown() gets called on a closed
|
||||||
|
# socket. We ignore it here as the data has already been read
|
||||||
|
# into the buffer at this point.
|
||||||
|
pass
|
||||||
|
|
||||||
response = TPLinkSmartHomeProtocol.decrypt(buffer[4:])
|
response = TPLinkSmartHomeProtocol.decrypt(buffer[4:])
|
||||||
_LOGGER.debug("< (%i) %s", len(response), response)
|
_LOGGER.debug("< (%i) %s", len(response), response)
|
||||||
|
Loading…
Reference in New Issue
Block a user