summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2011-05-07 12:44:11 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2011-05-07 12:44:11 (GMT)
commit2261b325ab15e1dc871b70f264e7927e85ecb201 (patch)
treee1c642413bf5dee4d2496e30a96069d11d084900 /Lib
parentce792301738bc6a1e95d0310bacb664f8d31a747 (diff)
downloadcpython-2261b325ab15e1dc871b70f264e7927e85ecb201.zip
cpython-2261b325ab15e1dc871b70f264e7927e85ecb201.tar.gz
cpython-2261b325ab15e1dc871b70f264e7927e85ecb201.tar.bz2
Close socket on connection failure.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/logging/handlers.py3
1 files changed, 3 insertions, 0 deletions
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: