Skip to content

Commit

Permalink
mon: use our standard indicator for locked/unlocked in ms_dispatch:
Browse files Browse the repository at this point in the history
ms_dispatch locks and calls _ms_dispatch.
  • Loading branch information
Greg Farnum committed Mar 18, 2010
1 parent 3bd625c commit 65e53e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/mon/Monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ void Monitor::handle_forward(MForward *m)
//set the Connection to be the one it came in on so we don't
//deref bad memory later
req->set_connection(m->get_connection()->get());
ms_dispatch(req, false);
_ms_dispatch(req);
m->msg = NULL;
delete m;
}
Expand Down Expand Up @@ -516,10 +516,9 @@ void Monitor::stop_cluster()
}


bool Monitor::ms_dispatch(Message *m, bool do_lock)
bool Monitor::_ms_dispatch(Message *m)
{
bool ret = true;
if (do_lock) lock.Lock();

Connection *connection = m->get_connection();
Session *s = NULL;
Expand Down Expand Up @@ -736,7 +735,6 @@ do { \
if (s) {
s->put();
}
if (do_lock) lock.Unlock();

return ret;
}
Expand Down
11 changes: 8 additions & 3 deletions src/mon/Monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,14 @@ void send_command(const entity_inst_t& inst,

private:
//ms_dispatch handles a lot of logic and we want to reuse it
//on forwarded messages, so we let it be non-locking as well
bool ms_dispatch(Message *m, bool do_lock=true);
bool ms_dispatch(Message *m) { return ms_dispatch(m, true); }
//on forwarded messages, so we create a non-locking version for this class
bool _ms_dispatch(Message *m);
bool ms_dispatch(Message *m) {
lock.Lock();
bool ret = _ms_dispatch(m);
lock.Unlock();
return ret;
}
//fill in caps field if possible
void fill_caps(Message *m);
bool ms_get_authorizer(int dest_type, AuthAuthorizer **authorizer, bool force_new);
Expand Down

0 comments on commit 65e53e7

Please sign in to comment.