On Fri, Oct 10, 2008 at 01:43:44PM +0200,
Francis Dupont <[EMAIL PROTECTED]> wrote
a message of 27 lines which said:
> - simply move to epoll which has still good performance with a large
> amount of file descriptors
OK, dnspython developers, what do you think of the attached patch?
I tested it only in very simple conditions, expect more testing soon.
Index: query.py
===================================================================
--- query.py (revision 144)
+++ query.py (working copy)
@@ -47,6 +47,12 @@
def _wait_for(ir, iw, ix, expiration):
done = False
+ poll_obj = select.poll()
+ for fd in ir:
+ poll_obj.register(fd, select.POLLIN | select.POLLPRI)
+ for fd in iw:
+ poll_obj.register(fd, select.POLLOUT)
+ # Ignore ix, in the mean time
while not done:
if expiration is None:
timeout = None
@@ -56,14 +62,14 @@
raise dns.exception.Timeout
try:
if timeout is None:
- (r, w, x) = select.select(ir, iw, ix)
+ descrs_ready = poll_obj.poll()
else:
- (r, w, x) = select.select(ir, iw, ix, timeout)
+ descrs_ready = poll_obj.poll(timeout)
except select.error, e:
if e.args[0] != errno.EINTR:
raise e
done = True
- if len(r) == 0 and len(w) == 0 and len(x) == 0:
+ if len(descrs_ready) == 0:
raise dns.exception.Timeout
def _wait_for_readable(s, expiration):
_______________________________________________
dnspython-users mailing list
[email protected]
http://howl.play-bow.org/mailman/listinfo.cgi/dnspython-users