This commit is contained in:
Denis Bilenko
2008-10-28 14:03:31 +06:00
5 changed files with 23 additions and 6 deletions

10
NEWS
View File

@@ -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)

View File

@@ -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):

View File

@@ -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

View File

@@ -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

View File

@@ -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',