Merge pull request #30840 from majianpeng/async-messenger-narrow-lock

msg/async: narrow scope of AsyncMessenger::lock in fun connect_to.

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Kefu Chai 2019-10-21 12:13:47 +08:00 committed by GitHub
commit 3ae93a77c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -680,7 +680,6 @@ ConnectionRef AsyncMessenger::connect_to(int type,
const entity_addrvec_t& addrs,
bool anon)
{
std::lock_guard l{lock};
if (*my_addrs == addrs ||
(addrs.v.size() == 1 &&
my_addrs->contains(addrs.front()))) {
@ -688,6 +687,8 @@ ConnectionRef AsyncMessenger::connect_to(int type,
return local_connection;
}
std::lock_guard l{lock};
auto av = _filter_addrs(addrs);
if (anon) {