mirror of
https://github.com/python/cpython.git
synced 2025-12-10 19:10:59 +00:00
logging's SocketHandler: get rid of some legacy code and use the newer socket.create_connection() utility function
This commit is contained in:
parent
7707f6fd32
commit
35eeb30adf
1 changed files with 1 additions and 9 deletions
|
|
@ -496,15 +496,7 @@ class SocketHandler(logging.Handler):
|
||||||
A factory method which allows subclasses to define the precise
|
A factory method which allows subclasses to define the precise
|
||||||
type of socket they want.
|
type of socket they want.
|
||||||
"""
|
"""
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
return socket.create_connection((self.host, self.port), timeout=timeout)
|
||||||
if hasattr(s, 'settimeout'):
|
|
||||||
s.settimeout(timeout)
|
|
||||||
try:
|
|
||||||
s.connect((self.host, self.port))
|
|
||||||
return s
|
|
||||||
except socket.error:
|
|
||||||
s.close()
|
|
||||||
raise
|
|
||||||
|
|
||||||
def createSocket(self):
|
def createSocket(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue