Close socket on deletion

(bash was complaining)
This commit is contained in:
David Preece
2017-01-16 15:43:48 +13:00
parent e97627e00b
commit 9da2df5e2d

View File

@@ -24,6 +24,11 @@ class UnixHTTPConnection(HTTPConnection):
HTTPConnection.__init__(self, 'localhost', timeout=timeout)
self.unix_socket_url = unix_socket_url
self.timeout = timeout
self.sock = None
def __del__(self): # base class does not have d'tor
if self.sock:
self.sock.close()
def connect(self):
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)