projects
/
apachelog.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
813f0a7
)
Add socket.setdefaulttimeout example to Resolver doctest.
author
W. Trevor King
<wking@drexel.edu>
Sat, 18 Feb 2012 19:31:42 +0000
(14:31 -0500)
committer
W. Trevor King
<wking@drexel.edu>
Sat, 18 Feb 2012 19:31:42 +0000
(14:31 -0500)
apachelog/resolve.py
patch
|
blob
|
history
diff --git
a/apachelog/resolve.py
b/apachelog/resolve.py
index db17f6bc20459a47a9689b380a2656c4a74eb05a..9d8b66c61830911d2dd8810acfdae672dbd328cb 100644
(file)
--- a/
apachelog/resolve.py
+++ b/
apachelog/resolve.py
@@
-8,6
+8,12
@@
class Resolver (object):
Maintains a class-level cache of resolved IPs to avoid repeated
lookups on the same IP address.
+ Avoid hanging if we can't resolve a name.
+
+ >>> import socket
+ >>> if hasattr(_socket, 'setdefaulttimeout'):
+ >>> socket.setdefaulttimeout(5) # set 5 second timeout
+
>>> r = Resolver()
>>> r.resolve('198.41.0.4')
'a.root-servers.net'