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): ...@@ -27,7 +27,7 @@ class BaseServer(object):
* an integer -- a shortcut for ``gevent.pool.Pool(integer)`` * 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__ # the default backlog to use if none was provided in __init__
backlog = 256 backlog = 256
...@@ -61,17 +61,17 @@ class BaseServer(object): ...@@ -61,17 +61,17 @@ class BaseServer(object):
def set_spawn(self, spawn): def set_spawn(self, spawn):
if spawn == 'default': if spawn == 'default':
self.pool = None self.pool = None
self.spawn = self.spawn self._spawn = self._spawn
elif hasattr(spawn, 'spawn'): elif hasattr(spawn, 'spawn'):
self.pool = spawn self.pool = spawn
self.spawn = spawn.spawn self._spawn = spawn.spawn
elif isinstance(spawn, int): elif isinstance(spawn, int):
from gevent.pool import Pool from gevent.pool import Pool
self.pool = Pool(spawn) self.pool = Pool(spawn)
self.spawn = self.pool.spawn self._spawn = self.pool.spawn
else: else:
self.pool = None self.pool = None
self.spawn = spawn self._spawn = spawn
if hasattr(self.pool, 'full'): if hasattr(self.pool, 'full'):
self.full = self.pool.full self.full = self.pool.full
......
...@@ -21,7 +21,7 @@ class HTTPServer(BaseServer): ...@@ -21,7 +21,7 @@ class HTTPServer(BaseServer):
return self.http is not None return self.http is not None
def _on_request(self, request): def _on_request(self, request):
spawn = self.spawn spawn = self._spawn
if spawn is None: if spawn is None:
self.handle(request) self.handle(request)
else: else:
......
...@@ -120,7 +120,7 @@ class StreamServer(BaseServer): ...@@ -120,7 +120,7 @@ class StreamServer(BaseServer):
self.delay = self.min_delay self.delay = self.min_delay
client_socket = socket.socket(_sock=client_socket) client_socket = socket.socket(_sock=client_socket)
spawn = self.spawn spawn = self._spawn
if spawn is None: if spawn is None:
self._handle(client_socket, address) self._handle(client_socket, address)
else: 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