diff --git a/NEWS b/NEWS index 86efb0c..2eb2304 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,15 @@ +0.8.x +===== + +Fix a CPU leak that would cause the poll hub to consume 100% CPU in certain conditions, for example the echoserver example. (Donovan Preston) + +Fix the libev hub to match libev's callback signature. (Patch by grugq) + +Add a backlog argument to api.tcp_listener (Patch by grugq) + 0.7.x ===== + Fix a major memory leak when using the libevent or libev hubs. Timers were not being removed from the hub after they fired. (Thanks Agusto Becciu and the grugq). Also, make it possible to call wrap_socket_with_coroutine_socket without using the threadpool to make dns operations non-blocking (Thanks the grugq). It's now possible to use eventlet's SSL client to talk to eventlet's SSL server. (Thanks to Ryan Williams) diff --git a/eventlet/api.py b/eventlet/api.py index 1a9f797..4765545 100644 --- a/eventlet/api.py +++ b/eventlet/api.py @@ -47,7 +47,7 @@ class TimeoutError(Exception): _threadlocal = tls.local() -def tcp_listener(address): +def tcp_listener(address, backlog=50): """ Listen on the given (ip, port) *address* with a TCP socket. Returns a socket object on which one should call ``accept()`` to @@ -59,7 +59,7 @@ def tcp_listener(address): """ from eventlet import greenio, util socket = greenio.GreenSocket(util.tcp_socket()) - util.socket_bind_and_listen(socket, address) + util.socket_bind_and_listen(socket, address, backlog=backlog) return socket def ssl_listener(address, certificate, private_key): diff --git a/eventlet/hubs/libev.py b/eventlet/hubs/libev.py index 423ce84..637c670 100644 --- a/eventlet/hubs/libev.py +++ b/eventlet/hubs/libev.py @@ -51,13 +51,17 @@ class Hub(hub.BaseHub): sig.start() def add_descriptor(self, fileno, read=None, write=None, exc=None): + def do_cb(watcher, event): + func, fileno = watcher.data + func(fileno) + if read: - evt = libev.Io(fileno, libev.EV_READ, self._evloop, read, fileno) + evt = libev.Io(fileno, libev.EV_READ, self._evloop, do_cb, (read, fileno)) evt.start() self.readers[fileno] = evt, read if write: - evt = libev.Io(fileno, libev.EV_WRITE, self._evloop, write, fileno) + evt = libev.Io(fileno, libev.EV_WRITE, self._evloop, do_cb, (write, fileno)) evt.start() self.writers[fileno] = evt, write diff --git a/eventlet/hubs/poll.py b/eventlet/hubs/poll.py index b0f741b..981c153 100644 --- a/eventlet/hubs/poll.py +++ b/eventlet/hubs/poll.py @@ -64,7 +64,10 @@ class Hub(hub.BaseHub): def remove_descriptor(self, fileno): super(Hub, self).remove_descriptor(fileno) - self.poll.unregister(fileno) + try: + self.poll.unregister(fileno) + except KeyError: + pass def wait(self, seconds=None): readers = self.readers diff --git a/setup.py b/setup.py index 27360e4..be4e774 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ from setuptools import find_packages, setup setup( name='eventlet', - version='0.8pre', + version='0.9pre', description='Coroutine-based networking library', author='Linden Lab', author_email='eventletdev@lists.secondlife.com',