Fix support for eventlet 0.9.16
The changes in c7059ae54e
were not enough
to provide compatibility with 0.9.16 and 0.9.17.ith 0.9.16 and 0.9.17.
Change-Id: Id1ddc988443e162f1c835505b619b7b45e86578d
Signed-off-by: Tomas Sedovic <tomas@sedovic.cz>
This commit is contained in:
parent
1ce586c96c
commit
1c485f9ae1
@ -242,9 +242,9 @@ class Server(object):
|
|||||||
eventlet.patcher.monkey_patch(all=False, socket=True)
|
eventlet.patcher.monkey_patch(all=False, socket=True)
|
||||||
self.pool = eventlet.GreenPool(size=self.threads)
|
self.pool = eventlet.GreenPool(size=self.threads)
|
||||||
try:
|
try:
|
||||||
eventlet.wsgi.server(self.sock, self.application,
|
eventlet_wsgi_server(self.sock, self.application,
|
||||||
url_length_limit=URL_LENGTH_LIMIT,
|
|
||||||
custom_pool=self.pool,
|
custom_pool=self.pool,
|
||||||
|
url_length_limit=URL_LENGTH_LIMIT,
|
||||||
log=WritableLogger(self.logger))
|
log=WritableLogger(self.logger))
|
||||||
except socket.error, err:
|
except socket.error, err:
|
||||||
if err[0] != errno.EINVAL:
|
if err[0] != errno.EINVAL:
|
||||||
@ -254,12 +254,25 @@ class Server(object):
|
|||||||
def _single_run(self, application, sock):
|
def _single_run(self, application, sock):
|
||||||
"""Start a WSGI server in a new green thread."""
|
"""Start a WSGI server in a new green thread."""
|
||||||
self.logger.info(_("Starting single process server"))
|
self.logger.info(_("Starting single process server"))
|
||||||
eventlet.wsgi.server(sock, application,
|
eventlet_wsgi_server(sock, application,
|
||||||
custom_pool=self.pool,
|
custom_pool=self.pool,
|
||||||
url_length_limit=URL_LENGTH_LIMIT,
|
url_length_limit=URL_LENGTH_LIMIT,
|
||||||
log=WritableLogger(self.logger))
|
log=WritableLogger(self.logger))
|
||||||
|
|
||||||
|
|
||||||
|
def eventlet_wsgi_server(sock, application, **kwargs):
|
||||||
|
'''
|
||||||
|
Return a new instance of the eventlet wsgi server with the proper url limit
|
||||||
|
in a way that's compatible with eventlet 0.9.16 and 0.9.17.
|
||||||
|
'''
|
||||||
|
try:
|
||||||
|
return eventlet.wsgi.server(sock, application, **kwargs)
|
||||||
|
# TODO(shadower) remove this when we don't support eventlet 0.9.16 anymore
|
||||||
|
except TypeError:
|
||||||
|
kwargs.pop('url_length_limit', None)
|
||||||
|
return eventlet.wsgi.server(sock, application, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class Middleware(object):
|
class Middleware(object):
|
||||||
"""
|
"""
|
||||||
Base WSGI middleware wrapper. These classes require an application to be
|
Base WSGI middleware wrapper. These classes require an application to be
|
||||||
|
Loading…
Reference in New Issue
Block a user