]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonClient.h: remove repeated searching of map 10601/head
authorMichal Jarzabek <stiopa@gmail.com>
Sat, 6 Aug 2016 07:26:14 +0000 (08:26 +0100)
committerMichal Jarzabek <stiopa@gmail.com>
Mon, 19 Sep 2016 21:21:59 +0000 (22:21 +0100)
Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
src/mon/MonClient.h

index f0383880ec9e014117586b1d6d72330e2fcf52bc..2966310c18dcdbc27ded9984cab9950ef59b90aa 100644 (file)
@@ -210,14 +210,19 @@ private:
   void handle_subscribe_ack(MMonSubscribeAck* m);
 
   bool _sub_want(const string &what, version_t start, unsigned flags) {
-    if ((sub_new.count(what) == 0 &&
-        sub_sent.count(what) &&
-        sub_sent[what].start == start &&
-        sub_sent[what].flags == flags) ||
-       (sub_new.count(what) &&
-        sub_new[what].start == start &&
-        sub_new[what].flags == flags))
+    auto sub = sub_new.find(what);
+    if (sub != sub_new.end() &&
+        sub->second.start == start &&
+        sub->second.flags == flags) {
       return false;
+    } else {
+      sub = sub_sent.find(what);
+      if (sub != sub_sent.end() &&
+         sub->second.start == start &&
+         sub->second.flags == flags)
+       return false;
+    }
+
     sub_new[what].start = start;
     sub_new[what].flags = flags;
     return true;