From: Sage Weil Date: Tue, 13 Sep 2011 03:54:06 +0000 (-0700) Subject: msgr: send_keepalive to a Connection X-Git-Tag: v0.35~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=691794f129f98a6c3e46408af8f6d360c62f3f55;p=ceph.git msgr: send_keepalive to a Connection This avoids the lookup, if we already have a reference. Mirrors the send_message() Connection variant. Signed-off-by: Sage Weil --- diff --git a/src/msg/Messenger.h b/src/msg/Messenger.h index 6b9d82aad3c73..2e257084b7542 100644 --- a/src/msg/Messenger.h +++ b/src/msg/Messenger.h @@ -160,6 +160,7 @@ protected: } virtual int lazy_send_message(Message *m, Connection *con) = 0; virtual int send_keepalive(const entity_inst_t& dest) = 0; + virtual int send_keepalive(Connection *con) = 0; virtual void mark_down(const entity_addr_t& a) = 0; virtual void mark_down(Connection *con) = 0; diff --git a/src/msg/SimpleMessenger.cc b/src/msg/SimpleMessenger.cc index 3e8fbf503e246..20e81cdf57e75 100644 --- a/src/msg/SimpleMessenger.cc +++ b/src/msg/SimpleMessenger.cc @@ -2608,6 +2608,21 @@ int SimpleMessenger::send_keepalive(const entity_inst_t& dest) return 0; } +int SimpleMessenger::send_keepalive(Connection *con) +{ + SimpleMessenger::Pipe *pipe = (SimpleMessenger::Pipe *)con->get_pipe(); + if (pipe) { + ldout(cct,20) << "send_keepalive con " << con << ", have pipe." << dendl; + pipe->pipe_lock.Lock(); + pipe->_send_keepalive(); + pipe->pipe_lock.Unlock(); + pipe->put(); + } else { + ldout(cct,0) << "send_keepalive con " << con << ", no pipe." << dendl; + } + return 0; +} + void SimpleMessenger::wait() diff --git a/src/msg/SimpleMessenger.h b/src/msg/SimpleMessenger.h index a24fe8cf8bcb8..9938ef3195f0f 100644 --- a/src/msg/SimpleMessenger.h +++ b/src/msg/SimpleMessenger.h @@ -606,6 +606,7 @@ public: void submit_message(Message *m, Pipe *pipe); int send_keepalive(const entity_inst_t& addr); + int send_keepalive(Connection *con); void learned_addr(const entity_addr_t& peer_addr_for_me); void init_local_pipe();