Close socket on connection failure.

This commit is contained in:
Vinay Sajip 2011-05-07 13:44:11 +01:00
parent ce79230173
commit 2261b325ab
1 changed files with 3 additions and 0 deletions

View File

@ -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: