From df9486bcc70064ca22d21e0224f9e4c8aaa8966b Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Fri, 27 Feb 2015 19:06:56 +0000 Subject: [PATCH] mon: Monitor: have reply functions for op requests Signed-off-by: Joao Eduardo Luis --- src/mon/Monitor.cc | 18 ++++++++++++++++++ src/mon/Monitor.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 900ac4f58b7f4..e716ea4edb556 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3008,6 +3008,17 @@ void Monitor::reply_command(MMonCommand *m, int rc, const string &rs, bufferlist send_reply(m, reply); } +void Monitor::reply_command(MonOpRequestRef op, int rc, const string &rs, + bufferlist& rdata, version_t version) +{ + MMonCommand *m = static_cast(op->get_req()); + assert(m->get_type() == MSG_MON_COMMAND); + MMonCommandAck *reply = new MMonCommandAck(m->cmd, rc, rs, version); + reply->set_tid(m->get_tid()); + reply->set_data(rdata); + send_reply(op, reply); +} + // ------------------------ // request/reply routing @@ -3159,6 +3170,13 @@ void Monitor::try_send_message(Message *m, const entity_inst_t& to) } } +void Monitor::send_reply(MonOpRequestRef op, Message *reply) +{ + dout(2) << __func__ << " " << op << " " << *reply << dendl; + op->send_reply(reply); +} + + void Monitor::send_reply(PaxosServiceMessage *req, Message *reply) { ConnectionRef connection = req->get_connection(); diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index a5cc6e3582312..ab7876f1fb420 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -761,6 +761,7 @@ public: void reply_command(MMonCommand *m, int rc, const string &rs, version_t version); void reply_command(MMonCommand *m, int rc, const string &rs, bufferlist& rdata, version_t version); + void reply_command(MonOpRequestRef op, int rc, const string &rs, bufferlist& rdata, version_t version); void handle_probe(MonOpRequestRef op); @@ -803,6 +804,7 @@ public: void handle_forward(MonOpRequestRef op); void try_send_message(Message *m, const entity_inst_t& to); void send_reply(PaxosServiceMessage *req, Message *reply); + void send_reply(MonOpRequestRef op, Message *reply); void no_reply(PaxosServiceMessage *req); void resend_routed_requests(); void remove_session(MonSession *s); -- 2.39.5