summaryrefslogtreecommitdiffstats
path: root/net/ceph/messenger.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-06-21 04:53:53 +0200
committerSage Weil <sage@inktank.com>2012-07-06 06:14:32 +0200
commitbc18f4b1c850ab355e38373fbb60fd28568d84b5 (patch)
treebe5f51233f281d329bc7648fbcf216deb4511b01 /net/ceph/messenger.c
parentlibceph: small changes to messenger.c (diff)
downloadlinux-bc18f4b1c850ab355e38373fbb60fd28568d84b5.tar.xz
linux-bc18f4b1c850ab355e38373fbb60fd28568d84b5.zip
libceph: add some fine ASCII art
Sage liked the state diagram I put in my commit description so I'm putting it in with the code. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to '')
-rw-r--r--net/ceph/messenger.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 4578e99bbef1..dcc50e4cd5cd 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -29,7 +29,47 @@
* the sender.
*/
-/* State values for ceph_connection->sock_state; NEW is assumed to be 0 */
+/*
+ * We track the state of the socket on a given connection using
+ * values defined below. The transition to a new socket state is
+ * handled by a function which verifies we aren't coming from an
+ * unexpected state.
+ *
+ * --------
+ * | NEW* | transient initial state
+ * --------
+ * | con_sock_state_init()
+ * v
+ * ----------
+ * | CLOSED | initialized, but no socket (and no
+ * ---------- TCP connection)
+ * ^ \
+ * | \ con_sock_state_connecting()
+ * | ----------------------
+ * | \
+ * + con_sock_state_closed() \
+ * |\ \
+ * | \ \
+ * | ----------- \
+ * | | CLOSING | socket event; \
+ * | ----------- await close \
+ * | ^ |
+ * | | |
+ * | + con_sock_state_closing() |
+ * | / \ |
+ * | / --------------- |
+ * | / \ v
+ * | / --------------
+ * | / -----------------| CONNECTING | socket created, TCP
+ * | | / -------------- connect initiated
+ * | | | con_sock_state_connected()
+ * | | v
+ * -------------
+ * | CONNECTED | TCP connection established
+ * -------------
+ *
+ * State values for ceph_connection->sock_state; NEW is assumed to be 0.
+ */
#define CON_SOCK_STATE_NEW 0 /* -> CLOSED */
#define CON_SOCK_STATE_CLOSED 1 /* -> CONNECTING */