diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2007-04-09 16:16:10 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2007-04-09 16:16:10 (GMT) |
commit | aa7b16a888eb53fdc4d7f194f3d49e6e8fe3ac24 (patch) | |
tree | bb8027d2b966607a899222f10b9fda77f6160fb6 /Lib/logging | |
parent | 55a1864832a02725b339a9ae98dd6849251c623b (diff) | |
download | cpython-aa7b16a888eb53fdc4d7f194f3d49e6e8fe3ac24.zip cpython-aa7b16a888eb53fdc4d7f194f3d49e6e8fe3ac24.tar.gz cpython-aa7b16a888eb53fdc4d7f194f3d49e6e8fe3ac24.tar.bz2 |
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/handlers.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index f877c15..c713a11 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -361,12 +361,14 @@ class SocketHandler(logging.Handler): self.retryMax = 30.0 self.retryFactor = 2.0 - def makeSocket(self): + def makeSocket(self, timeout=1): """ 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) s.connect((self.host, self.port)) return s |