[Python-checkins] cpython (3.4): asyncio doc: document Protocol state machine

victor.stinner python-checkins at python.org
Thu Jan 29 13:34:56 CET 2015


https://hg.python.org/cpython/rev/4fe1303bf531
changeset:   94368:4fe1303bf531
branch:      3.4
parent:      94366:65ee4dec4f1d
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Jan 29 13:33:15 2015 +0100
summary:
  asyncio doc: document Protocol state machine

files:
  Doc/library/asyncio-protocol.rst |  8 ++++++++
  Lib/asyncio/protocols.py         |  5 +++++
  2 files changed, 13 insertions(+), 0 deletions(-)


diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst
--- a/Doc/library/asyncio-protocol.rst
+++ b/Doc/library/asyncio-protocol.rst
@@ -374,6 +374,14 @@
 a connection.  However, :meth:`eof_received` is called at most once
 and, if called, :meth:`data_received` won't be called after it.
 
+State machine:
+
+    start -> :meth:`~BaseProtocol.connection_made`
+    [-> :meth:`~Protocol.data_received` \*]
+    [-> :meth:`~Protocol.eof_received` ?]
+    -> :meth:`~BaseProtocol.connection_lost` -> end
+
+
 Datagram protocols
 ------------------
 
diff --git a/Lib/asyncio/protocols.py b/Lib/asyncio/protocols.py
--- a/Lib/asyncio/protocols.py
+++ b/Lib/asyncio/protocols.py
@@ -78,6 +78,11 @@
     State machine of calls:
 
       start -> CM [-> DR*] [-> ER?] -> CL -> end
+
+    * CM: connection_made()
+    * DR: data_received()
+    * ER: eof_received()
+    * CL: connection_lost()
     """
 
     def data_received(self, data):

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list