]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: Add at least a little documentation
authorGreg Farnum <gregf@hq.newdream.net>
Thu, 10 Dec 2009 22:32:13 +0000 (14:32 -0800)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 10 Dec 2009 22:56:44 +0000 (14:56 -0800)
src/msg/SimpleMessenger.cc
src/msg/SimpleMessenger.h

index 227a24b74ae1c063e0f708c4334a3b6951fb52ce..e0689c0dffea5b597ca1c818a080add5edc145f0 100644 (file)
@@ -257,6 +257,15 @@ void SimpleMessenger::Accepter::stop()
  * Endpoint
  */
 
+/*
+ * This function delivers incoming messages to the Messenger.
+ * Pipes with messages are kept in queues; when beginning a message
+ * delivery the highest-priority queue is selected, the pipe from the
+ * front of the queue is removed, and its message read. If the pipe
+ * has remaining messages at that priority level, it is re-placed on to the
+ * end of the queue. If the queue is empty; it's removed.
+ * The message is then delivered and the process starts again.
+ */
 void SimpleMessenger::Endpoint::dispatch_entry()
 {
   endpoint_lock.Lock();
@@ -1173,6 +1182,10 @@ void SimpleMessenger::Pipe::requeue_sent()
   }
 }
 
+/*
+ * Tears down the Pipe's message queues, and removes them from the Endpoint.
+ * Must hold pipe_lock prior to calling.
+ */
 void SimpleMessenger::Pipe::discard_queue()
 {
   dout(10) << "discard_queue" << dendl;
index 8fd31715d6725a2fba39553ad58dfaa8c9c69610..86396f2c947c4d08a925b922f9ad90e026d0b00f 100644 (file)
@@ -35,6 +35,17 @@ using namespace __gnu_cxx;
 #include "tcp.h"
 
 
+/*
+ * This class handles transmission and reception of messages. Generally
+ * speaking, there are 3 major components:
+ * 1) SimpleMessenger. It's the exterior class and handles the others.
+ * 2) Endpoint. Wraps the Messenger object which this SimpleMessenger serves,
+ *    and handles individual message delivery. Once upon a time you could have
+ *    multiple Endpoints in a SimpleMessenger; now it *might* be simpler and
+ *    cleaner to merge the class with SimpleMessenger itself.
+ * 3) Pipe. Each network connection is handled through a pipe, which handles
+ *    the input and output of each message.
+ */
 
 /* Rank - per-process
  */
@@ -217,6 +228,7 @@ private:
 
     //we have two queue_received's to allow local signal delivery
     // via Message * (that doesn't actually point to a Message)
+    //Don't call while holding pipe_lock!
     void queue_received(Message *m, int priority) {
       list<Message *>& queue = in_q[priority];