]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: use our standard indicator for locked/unlocked in ms_dispatch:
authorGreg Farnum <gregf@hq.newdream.net>
Thu, 18 Mar 2010 21:26:08 +0000 (14:26 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 18 Mar 2010 21:47:43 +0000 (14:47 -0700)
ms_dispatch locks and calls _ms_dispatch.

src/mon/Monitor.cc
src/mon/Monitor.h

index ee572806d799797ca71bc901766c651ac6e29361..ea415f50be9add19f29807814cf9f0bcdb5ea682 100644 (file)
@@ -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;
 }
index f7e693b38eeaad4740a8f02d685d64248b1d4f20..c8b2f03cecd477ac273303f95aa9eef646bb5503 100644 (file)
@@ -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);