mirror of
				https://github.com/python-kasa/python-kasa.git
				synced 2025-11-02 21:52:00 +00:00 
			
		
		
		
	Merge pull request #41 from rytilahti/ignore_oserror_on_shutdown
Ignore OSError on socket.shutdown()
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user