Replace connection_refused() with error_received().

This commit is contained in:
Guido van Rossum 2013-11-15 16:47:42 -08:00
parent d7061c0d55
commit bf9b4e10d1
1 changed files with 9 additions and 16 deletions

View File

@ -1259,15 +1259,11 @@ Datagram transports have these methods:
Datagram transports call the following methods on the associated
protocol object: ``connection_made()``, ``connection_lost()``,
``connection_refused()`` and ``datagram_received()``. ("Connection"
``error_received()`` and ``datagram_received()``. ("Connection"
in these method names is a slight misnomer, but the concepts still
exist: ``connection_made()`` means the transport representing the
endpoint has been created, and ``connection_lost()`` means the
transport is closed. The ``connection_refused()`` method is called
before ``connection_lost()`` when ``remote_addr`` was given and an
explicit negative acknowledgement was received (this is a UDP
feature). (TBD: Should fix `connection_refused()`` to not close the
transport.)
transport is closed.)
Subprocess Transports
'''''''''''''''''''''
@ -1390,20 +1386,17 @@ In addition, they have the following methods:
``data`` (a bytes objects) was received from remote address ``addr``
(an IPv4 2-tuple or an IPv6 4-tuple).
- ``connection_refused(exc)``. Indicates that a send or receive
operation raised a ``ConnectionRefused`` exception. This typically
indicates that a negative acknowledgment was received for a
previously sent datagram (not for the datagram that was being sent,
if the exception was raised by a send operation). Immediately after
this the socket will be closed and ``connection_lost()`` will be
called with the same exception argument.
- ``error_received(exc)``. Indicates that a send or receive operation
raised an ``OSError`` exception. Since datagram errors may be
transient, it is up to the protocol to call the transport's
``close()`` method if it wants to close the endpoint.
Here is a chart indicating the order and multiplicity of calls:
1. ``connection_made()`` -- exactly once
2. ``datagram_received()`` -- zero or more times
3. ``connection_refused()`` -- at most once
4. ``connection_lost()`` -- exactly once
2. ``datagram_received()``, ``error_received()`` -- zero or more times
3. ``connection_lost()`` -- exactly once
Subprocess Protocol
'''''''''''''''''''