This avoids the lookup, if we already have a reference. Mirrors the
send_message() Connection variant.
Signed-off-by: Sage Weil <sage@newdream.net>
}
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;
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()
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();