mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-04-26 16:46:23 +00:00
Merge pull request #41 from rytilahti/ignore_oserror_on_shutdown
Ignore OSError on socket.shutdown()
This commit is contained in:
commit
900b5394f4
@ -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…
x
Reference in New Issue
Block a user