LogClient: Add a mon data member and mon selection code.

Replaces removed MonMap::pick_mon
This commit is contained in:
Greg Farnum 2009-10-12 11:29:33 -07:00
parent d3ebec388e
commit afa15782c4
2 changed files with 8 additions and 6 deletions

View File

@ -79,11 +79,12 @@ void LogClient::_send_log()
return;
MLog *log = new MLog(monmap->get_fsid(), log_queue);
int mon;
if (messenger->get_myname().is_mon())
mon = messenger->get_myname().num(); // if we are a monitor, queue for ourselves
else
mon = monmap->pick_mon();
if (mon < 0) {
if (messenger->get_myname().is_mon())
mon = messenger->get_myname().num(); // if we are a monitor, queue for ourselves
else
mon = rand() % monmap->mon_inst.size();
}
dout(10) << "send_log to mon" << mon << dendl;
messenger->send_message(log, monmap->get_inst(mon));

View File

@ -31,6 +31,7 @@ class MonMap;
class LogClient : public Dispatcher {
Messenger *messenger;
MonMap *monmap;
int mon;
bool ms_dispatch(Message *m);
bool is_synchronous;
@ -56,7 +57,7 @@ class LogClient : public Dispatcher {
void set_synchronous(bool sync) { is_synchronous = sync; }
LogClient(Messenger *m, MonMap *mm) :
messenger(m), monmap(mm), is_synchronous(false),
messenger(m), monmap(mm), mon(-1), is_synchronous(false),
log_lock("LogClient::log_lock"), last_log(0) { }
};