]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg: Use with_val, don't copy a string just to call find
authorAdam C. Emerson <aemerson@redhat.com>
Mon, 20 Nov 2017 21:12:03 +0000 (16:12 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Thu, 7 Dec 2017 20:46:11 +0000 (15:46 -0500)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/msg/async/AsyncConnection.cc

index ae34f07c755cbd6149664b3c8c8142b2f669bc2d..43277182056da673ac104400a1a4df8e759b0b3d 100644 (file)
@@ -159,11 +159,16 @@ AsyncConnection::~AsyncConnection()
 void AsyncConnection::maybe_start_delay_thread()
 {
   if (!delay_state) {
-    auto pos = async_msgr->cct->_conf->get_val<std::string>("ms_inject_delay_type").find(ceph_entity_type_name(peer_type));
-    if (pos != string::npos) {
-      ldout(msgr->cct, 1) << __func__ << " setting up a delay queue" << dendl;
-      delay_state = new DelayedDelivery(async_msgr, center, dispatch_queue, conn_id);
-    }
+    async_msgr->cct->_conf->with_val<std::string>(
+      "ms_inject_delay_type",
+      [this](const string& s) {
+       if (s.find(ceph_entity_type_name(peer_type)) != string::npos) {
+         ldout(msgr->cct, 1) << __func__ << " setting up a delay queue"
+                             << dendl;
+         delay_state = new DelayedDelivery(async_msgr, center, dispatch_queue,
+                                           conn_id);
+       }
+      });
   }
 }