[Python-checkins] peps: Replace connection_refused() with error_received().

guido.van.rossum python-checkins at python.org
Sat Nov 16 01:47:47 CET 2013


http://hg.python.org/peps/rev/d5db4dc4c4e8
changeset:   5273:d5db4dc4c4e8
user:        Guido van Rossum <guido at dropbox.com>
date:        Fri Nov 15 16:47:42 2013 -0800
summary:
  Replace connection_refused() with error_received().

files:
  pep-3156.txt |  25 +++++++++----------------
  1 files changed, 9 insertions(+), 16 deletions(-)


diff --git a/pep-3156.txt b/pep-3156.txt
--- a/pep-3156.txt
+++ b/pep-3156.txt
@@ -1259,15 +1259,11 @@
 
 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 @@
   ``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
 '''''''''''''''''''

-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list