msgr: add get_loopback_connection() method

Return the Connection* for ourselves, so we can queue messages for
ourselves.

Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2013-01-25 09:23:23 -08:00
parent a6ed62e324
commit a7059eb3f3
3 changed files with 9 additions and 0 deletions

View File

@ -439,6 +439,10 @@ public:
* @param dest The entity to get a connection for.
*/
virtual Connection *get_connection(const entity_inst_t& dest) = 0;
/**
* Get the Connection object associated with ourselves.
*/
virtual Connection *get_loopback_connection() = 0;
/**
* Send a "keepalive" ping to the given dest, if it has a working Connection.
* If the Messenger doesn't already have a Connection, or if the underlying

View File

@ -380,6 +380,10 @@ Connection *SimpleMessenger::get_connection(const entity_inst_t& dest)
}
}
Connection *SimpleMessenger::get_loopback_connection()
{
return (Connection*)local_connection->get();
}
void SimpleMessenger::submit_message(Message *m, Connection *con,
const entity_addr_t& dest_addr, int dest_type, bool lazy)

View File

@ -294,6 +294,7 @@ public:
* @return The requested Connection, as a pointer whose reference you own.
*/
virtual Connection *get_connection(const entity_inst_t& dest);
virtual Connection *get_loopback_connection();
/**
* Send a "keepalive" ping to the given dest, if it has a working Connection.
* If the Messenger doesn't already have a Connection, or if the underlying