From 734479657013dd9a52b4db9cde17a049f3b40094 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Mon, 20 Nov 2017 16:12:03 -0500 Subject: [PATCH] msg: Use with_val, don't copy a string just to call find Signed-off-by: Adam C. Emerson --- src/msg/async/AsyncConnection.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index ae34f07c755cb..43277182056da 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -159,11 +159,16 @@ AsyncConnection::~AsyncConnection() void AsyncConnection::maybe_start_delay_thread() { if (!delay_state) { - auto pos = async_msgr->cct->_conf->get_val("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( + "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); + } + }); } } -- 2.39.5