* 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();
}
}
+/*
+ * 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;
#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
*/
//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];