mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +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
|
||||
|
||||
finally:
|
||||
sock.shutdown(socket.SHUT_RDWR)
|
||||
sock.close()
|
||||
try:
|
||||
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:])
|
||||
_LOGGER.debug("< (%i) %s", len(response), response)
|
||||
|
Loading…
Reference in New Issue
Block a user