diff options
author | Guido van Rossum <guido@dropbox.com> | 2013-10-18 14:58:20 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@dropbox.com> | 2013-10-18 14:58:20 (GMT) |
commit | 57497ad1810304ef74774fb1abd379dec80f458b (patch) | |
tree | 1696f5389cdad967002eff56160765936aba9010 /Lib/asyncio | |
parent | 40b22d0661c45ac350a7252a32ef665b81b1643c (diff) | |
download | cpython-57497ad1810304ef74774fb1abd379dec80f458b.zip cpython-57497ad1810304ef74774fb1abd379dec80f458b.tar.gz cpython-57497ad1810304ef74774fb1abd379dec80f458b.tar.bz2 |
Rename Transport.pause/resume to pause_reading/pause_writing. Also relax timeout in test_call_later().
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/proactor_events.py | 6 | ||||
-rw-r--r-- | Lib/asyncio/selector_events.py | 14 | ||||
-rw-r--r-- | Lib/asyncio/streams.py | 4 | ||||
-rw-r--r-- | Lib/asyncio/transports.py | 6 | ||||
-rw-r--r-- | Lib/asyncio/unix_events.py | 4 |
5 files changed, 17 insertions, 17 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index c1347b7..665569f 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -94,12 +94,12 @@ class _ProactorReadPipeTransport(_ProactorBasePipeTransport, self._paused = False self._loop.call_soon(self._loop_reading) - def pause(self): - assert not self._closing, 'Cannot pause() when closing' + def pause_reading(self): + assert not self._closing, 'Cannot pause_reading() when closing' assert not self._paused, 'Already paused' self._paused = True - def resume(self): + def resume_reading(self): assert self._paused, 'Not paused' self._paused = False if self._closing: diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index e8ae885..2edac65 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -406,13 +406,13 @@ class _SelectorSocketTransport(_SelectorTransport): if waiter is not None: self._loop.call_soon(waiter.set_result, None) - def pause(self): - assert not self._closing, 'Cannot pause() when closing' + def pause_reading(self): + assert not self._closing, 'Cannot pause_reading() when closing' assert not self._paused, 'Already paused' self._paused = True self._loop.remove_reader(self._sock_fd) - def resume(self): + def resume_reading(self): assert self._paused, 'Not paused' self._paused = False if self._closing: @@ -590,19 +590,19 @@ class _SelectorSslTransport(_SelectorTransport): if self._waiter is not None: self._loop.call_soon(self._waiter.set_result, None) - def pause(self): + def pause_reading(self): # XXX This is a bit icky, given the comment at the top of # _on_ready(). Is it possible to evoke a deadlock? I don't # know, although it doesn't look like it; write() will still # accept more data for the buffer and eventually the app will - # call resume() again, and things will flow again. + # call resume_reading() again, and things will flow again. - assert not self._closing, 'Cannot pause() when closing' + assert not self._closing, 'Cannot pause_reading() when closing' assert not self._paused, 'Already paused' self._paused = True self._loop.remove_reader(self._sock_fd) - def resume(self): + def resume_reading(self): assert self._paused, 'Not paused' self._paused = False if self._closing: diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py index d0f12e8..9915aa5 100644 --- a/Lib/asyncio/streams.py +++ b/Lib/asyncio/streams.py @@ -106,7 +106,7 @@ class StreamReader: def _maybe_resume_transport(self): if self._paused and self.byte_count <= self.limit: self._paused = False - self._transport.resume() + self._transport.resume_reading() def feed_eof(self): self.eof = True @@ -133,7 +133,7 @@ class StreamReader: not self._paused and self.byte_count > 2*self.limit): try: - self._transport.pause() + self._transport.pause_reading() except NotImplementedError: # The transport can't be paused. # We'll just have to buffer all data. diff --git a/Lib/asyncio/transports.py b/Lib/asyncio/transports.py index bf3adee..f1a7180 100644 --- a/Lib/asyncio/transports.py +++ b/Lib/asyncio/transports.py @@ -29,15 +29,15 @@ class BaseTransport: class ReadTransport(BaseTransport): """ABC for read-only transports.""" - def pause(self): + def pause_reading(self): """Pause the receiving end. No data will be passed to the protocol's data_received() - method until resume() is called. + method until resume_reading() is called. """ raise NotImplementedError - def resume(self): + def resume_reading(self): """Resume the receiving end. Data received will once again be passed to the protocol's diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 34b2aea..a234f4f 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -232,10 +232,10 @@ class _UnixReadPipeTransport(transports.ReadTransport): self._loop.call_soon(self._protocol.eof_received) self._loop.call_soon(self._call_connection_lost, None) - def pause(self): + def pause_reading(self): self._loop.remove_reader(self._fileno) - def resume(self): + def resume_reading(self): self._loop.add_reader(self._fileno, self._read_ready) def close(self): |