]> granicus.if.org Git - python/commitdiff
asyncio doc: document Protocol state machine
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 29 Jan 2015 12:33:15 +0000 (13:33 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 29 Jan 2015 12:33:15 +0000 (13:33 +0100)
Doc/library/asyncio-protocol.rst
Lib/asyncio/protocols.py

index 60776d1e9e30b87e67e6686e6814d16977eb65ea..b6fcc4840b562fd6c5788a188ffed15cf8d94885 100644 (file)
@@ -374,6 +374,14 @@ The following callbacks are called on :class:`Protocol` instances:
 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
 ------------------
 
index 52fc25c2ee9a21456e13d51126159523e63a1f77..80fcac9a82dfb22b61b048d7cdba87c895fa2084 100644 (file)
@@ -78,6 +78,11 @@ class Protocol(BaseProtocol):
     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):