]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/async: remove redundant condition.
authorJianpeng Ma <jianpeng.ma@intel.com>
Wed, 25 Oct 2017 16:16:45 +0000 (00:16 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Wed, 25 Oct 2017 16:16:45 +0000 (00:16 +0800)
From the code, if out_q[r].is_empty, it already remove.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/msg/async/AsyncConnection.h

index e9a22d739a6fd41532870829afaec9a642c98f80..d337a7eea9d87f3f8d04db797ce75254f14cd88e 100644 (file)
@@ -113,17 +113,16 @@ class AsyncConnection : public Connection {
   }
   Message *_get_next_outgoing(bufferlist *bl) {
     Message *m = 0;
-    while (!m && !out_q.empty()) {
+    if (!out_q.empty()) {
       map<int, list<pair<bufferlist, Message*> > >::reverse_iterator it = out_q.rbegin();
-      if (!it->second.empty()) {
-        list<pair<bufferlist, Message*> >::iterator p = it->second.begin();
-        m = p->second;
-        if (bl)
-          bl->swap(p->first);
-        it->second.erase(p);
-      }
+      assert(!it->second.empty());
+      list<pair<bufferlist, Message*> >::iterator p = it->second.begin();
+      m = p->second;
+      if (bl)
+       bl->swap(p->first);
+      it->second.erase(p);
       if (it->second.empty())
-        out_q.erase(it->first);
+       out_q.erase(it->first);
     }
     return m;
   }