Kaydet (Commit) aa7b16a8 authored tarafından Vinay Sajip's avatar Vinay Sajip

Added optional timeout to SocketHandler.makeSocket (SF #1695948)

üst 55a18648
...@@ -361,12 +361,14 @@ class SocketHandler(logging.Handler): ...@@ -361,12 +361,14 @@ class SocketHandler(logging.Handler):
self.retryMax = 30.0 self.retryMax = 30.0
self.retryFactor = 2.0 self.retryFactor = 2.0
def makeSocket(self): def makeSocket(self, timeout=1):
""" """
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) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if hasattr(s, 'settimeout'):
s.settimeout(timeout)
s.connect((self.host, self.port)) s.connect((self.host, self.port))
return s return s
......
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