Commit 58184039 authored by Denis Bilenko's avatar Denis Bilenko

BaseServer: rename 'spawn' attribute to '_spawn'

to avoid confusion with Greenlet's spawn() classmethod
parent 0021cebd
......@@ -27,7 +27,7 @@ class BaseServer(object):
* an integer -- a shortcut for ``gevent.pool.Pool(integer)``
"""
spawn = Greenlet.spawn
_spawn = Greenlet.spawn
# the default backlog to use if none was provided in __init__
backlog = 256
......@@ -61,17 +61,17 @@ class BaseServer(object):
def set_spawn(self, spawn):
if spawn == 'default':
self.pool = None
self.spawn = self.spawn
self._spawn = self._spawn
elif hasattr(spawn, 'spawn'):
self.pool = spawn
self.spawn = spawn.spawn
self._spawn = spawn.spawn
elif isinstance(spawn, int):
from gevent.pool import Pool
self.pool = Pool(spawn)
self.spawn = self.pool.spawn
self._spawn = self.pool.spawn
else:
self.pool = None
self.spawn = spawn
self._spawn = spawn
if hasattr(self.pool, 'full'):
self.full = self.pool.full
......
......@@ -21,7 +21,7 @@ class HTTPServer(BaseServer):
return self.http is not None
def _on_request(self, request):
spawn = self.spawn
spawn = self._spawn
if spawn is None:
self.handle(request)
else:
......
......@@ -120,7 +120,7 @@ class StreamServer(BaseServer):
self.delay = self.min_delay
client_socket = socket.socket(_sock=client_socket)
spawn = self.spawn
spawn = self._spawn
if spawn is None:
self._handle(client_socket, address)
else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment