int reply_rc;
bufferlist reply_bl;
entity_inst_t reply_from;
-Context *resend_event = 0;
OSDMap *osdmap = 0;
Connection *command_con = NULL;
+Context *tick_event = 0;
+float tick_interval = 3.0;
// observe (push)
#include "mon/PGMap.h"
static set<int> registered, seen;
+struct C_Tick : public Context {
+ CephToolCtx *ctx;
+ C_Tick(CephToolCtx *c) : ctx(c) {}
+ void finish(int r) {
+ if (command_con)
+ messenger->send_keepalive(command_con);
+
+ assert(tick_event == this);
+ tick_event = new C_Tick(ctx);
+ ctx->timer.add_event_after(tick_interval, tick_event);
+ }
+};
+
static void send_command(CephToolCtx *ctx)
{
if (!pending_tell && !pending_tell_pgid) {
command_con = messenger->get_connection(osdmap->get_inst(n));
messenger->send_message(m, command_con);
+
+ if (tick_event)
+ ctx->timer.cancel_event(tick_event);
+ tick_event = new C_Tick(ctx);
+ ctx->timer.add_event_after(tick_interval, tick_event);
}
return;
}
reply_rc = ack->r;
reply_bl = ack->get_data();
cmd_cond.Signal();
- if (resend_event) {
- ctx->timer.cancel_event(resend_event);
- resend_event = 0;
- }
ctx->lock.Unlock();
ack->put();
}
reply_rc = ack->r;
reply_bl = ack->get_data();
cmd_cond.Signal();
- if (resend_event) {
- ctx->timer.cancel_event(resend_event);
- resend_event = 0;
+ if (tick_event) {
+ ctx->timer.cancel_event(tick_event);
+ tick_event = 0;
}
}
ctx->lock.Unlock();