From: Greg Farnum Date: Thu, 18 Mar 2010 21:26:08 +0000 (-0700) Subject: mon: use our standard indicator for locked/unlocked in ms_dispatch: X-Git-Tag: v0.20~240 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=65e53e7a7fc3a422b7273394d4c00a3c186c9486;p=ceph.git mon: use our standard indicator for locked/unlocked in ms_dispatch: ms_dispatch locks and calls _ms_dispatch. --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index ee572806d799..ea415f50be9a 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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; } @@ -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; @@ -736,7 +735,6 @@ out: if (s) { s->put(); } - if (do_lock) lock.Unlock(); return ret; } diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index f7e693b38eea..c8b2f03cecd4 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -208,9 +208,14 @@ public: 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);