From: Adam C. Emerson Date: Mon, 20 Nov 2017 21:12:03 +0000 (-0500) Subject: msg: Use with_val, don't copy a string just to call find X-Git-Tag: v13.0.2~802^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=734479657013dd9a52b4db9cde17a049f3b40094;p=ceph.git msg: Use with_val, don't copy a string just to call find Signed-off-by: Adam C. Emerson --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index ae34f07c755..43277182056 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); + } + }); } }