Commit 72d88add authored by Giampaolo Rodola's avatar Giampaolo Rodola

logging's SocketHandler: get rid of some legacy code and use the newer...

logging's SocketHandler: get rid of some legacy code and use the newer socket.create_connection() utility function
parent b0192982
......@@ -496,15 +496,7 @@ class SocketHandler(logging.Handler):
A factory method which allows subclasses to define the precise
type of socket they want.
"""
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if hasattr(s, 'settimeout'):
s.settimeout(timeout)
try:
s.connect((self.host, self.port))
return s
except socket.error:
s.close()
raise
return socket.create_connection((self.host, self.port), timeout=timeout)
def createSocket(self):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment