From 2261b325ab15e1dc871b70f264e7927e85ecb201 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Sat, 7 May 2011 13:44:11 +0100 Subject: Close socket on connection failure. --- Lib/logging/handlers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 0086808..7296472 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -469,6 +469,9 @@ class SocketHandler(logging.Handler): self.retryTime = None # next time, no delay before trying except socket.error: #Creation failed, so set the retry time and return. + if self.sock is not None: + self.sock.close() + self.sock = None if self.retryTime is None: self.retryPeriod = self.retryStart else: -- cgit v0.12