diff options
author | Sage Weil <sage@inktank.com> | 2013-01-25 09:23:23 -0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-02-04 22:05:56 -0800 |
commit | e4f7ff8c288eac8a8b57382f11a4b6f93682315a (patch) | |
tree | 8bdfe056675a268d984f55402cd808c8c9ffacfc | |
parent | 6f3c1cd2cc07d951dfc23e523b9c6400b7c77c72 (diff) | |
download | ceph-e4f7ff8c288eac8a8b57382f11a4b6f93682315a.tar.gz |
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>
(cherry picked from commit a7059eb3f3922cf08c1e5bb5958acc2d45952482)
-rw-r--r-- | src/msg/Messenger.h | 4 | ||||
-rw-r--r-- | src/msg/SimpleMessenger.cc | 4 | ||||
-rw-r--r-- | src/msg/SimpleMessenger.h | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/src/msg/Messenger.h b/src/msg/Messenger.h index 6ece6536ad7..b75e4420f66 100644 --- a/src/msg/Messenger.h +++ b/src/msg/Messenger.h @@ -440,6 +440,10 @@ public: */ 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 * connection has broken, this function does nothing. diff --git a/src/msg/SimpleMessenger.cc b/src/msg/SimpleMessenger.cc index 0e8ed27c7f4..dd496947151 100644 --- a/src/msg/SimpleMessenger.cc +++ b/src/msg/SimpleMessenger.cc @@ -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) diff --git a/src/msg/SimpleMessenger.h b/src/msg/SimpleMessenger.h index fb392e8f741..cc946e3d25a 100644 --- a/src/msg/SimpleMessenger.h +++ b/src/msg/SimpleMessenger.h @@ -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 |