Commit ab5b3850 authored by Denis Bilenko's avatar Denis Bilenko

socket.py: rename an argument of _wait() from 'io' to 'watcher'

parent 36409a82
...@@ -301,27 +301,25 @@ class socket(object): ...@@ -301,27 +301,25 @@ class socket(object):
result += ' timeout=' + str(self.timeout) result += ' timeout=' + str(self.timeout)
return result return result
def _wait(self, io, timeout_exc=timeout('timed out')): def _wait(self, watcher, timeout_exc=timeout('timed out')):
"""Block the current greenlet until *io* is ready. """Block the current greenlet until *watcher* has pending events.
If *timeout* is non-negative, then *timeout_exc* is raised after *timeout* second has passed. If *timeout* is non-negative, then *timeout_exc* is raised after *timeout* second has passed.
By default *timeout_exc* is ``socket.timeout('timed out')``. By default *timeout_exc* is ``socket.timeout('timed out')``.
If :func:`cancel_wait` is called, raise ``socket.error(EBADF, 'File descriptor was closed in another greenlet')``. If :func:`cancel_wait` is called, raise ``socket.error(EBADF, 'File descriptor was closed in another greenlet')``.
""" """
assert io.callback is None, 'This socket is already used by another greenlet: %r' % (io.callback, ) assert watcher.callback is None, 'This socket is already used by another greenlet: %r' % (watcher.callback, )
if self.timeout is not None: if self.timeout is not None:
timeout = Timeout.start_new(self.timeout, timeout_exc) timeout = Timeout.start_new(self.timeout, timeout_exc)
else: else:
timeout = None timeout = None
try: try:
self.hub.wait(io) self.hub.wait(watcher)
finally: finally:
if timeout is not None: if timeout is not None:
timeout.cancel() timeout.cancel()
# rename "io" to "watcher" because wait() works with any watcher
# make wait() a Hub's method
def accept(self): def accept(self):
sock = self._sock sock = self._sock
while True: while True:
......
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