]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: send_keepalive to a Connection
authorSage Weil <sage@newdream.net>
Tue, 13 Sep 2011 03:54:06 +0000 (20:54 -0700)
committerSage Weil <sage@newdream.net>
Tue, 13 Sep 2011 03:54:06 +0000 (20:54 -0700)
This avoids the lookup, if we already have a reference.  Mirrors the
send_message() Connection variant.

Signed-off-by: Sage Weil <sage@newdream.net>
src/msg/Messenger.h
src/msg/SimpleMessenger.cc
src/msg/SimpleMessenger.h

index 6b9d82aad3c73aa7042e64dd591d430d90e89d58..2e257084b75422fcd267ad2388fd764582d6c91a 100644 (file)
@@ -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;
index 3e8fbf503e246f9efec5ef7f667886e985eb386a..20e81cdf57e7572be9d64c2f7f056800ef14644d 100644 (file)
@@ -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()
index a24fe8cf8bcb8742bda8c0d835063339cfbb57f2..9938ef3195f0feffaccc52b4c8d9ad33ac69da98 100644 (file)
@@ -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();