Merge pull request #26923 from majianpeng/msg-optimize-check-loopback-con

msg/async/AsyncConnection: optimize check loopback connection.

Reviewed-by: Ricardo Dias <rdias@suse.com>
This commit is contained in:
Kefu Chai 2019-03-22 15:31:07 +08:00 committed by GitHub
commit 81268eb71d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -53,6 +53,7 @@ struct Connection : public RefCountedObject {
private:
uint64_t features;
public:
bool is_loopback;
bool failed; // true if we are a lossy connection that has failed.
int rx_buffers_version;
@ -81,6 +82,7 @@ public:
msgr(m),
peer_type(-1),
features(0),
is_loopback(false),
failed(false),
rx_buffers_version(0) {
}

View File

@ -516,7 +516,7 @@ int AsyncConnection::send_message(Message *m)
else if (m->get_type() == CEPH_MSG_OSD_OPREPLY)
OID_EVENT_TRACE_WITH_MSG(m, "SEND_MSG_OSD_OPREPLY_BEGIN", true);
if (async_msgr->get_myaddrs() == get_peer_addrs()) { //loopback connection
if (is_loopback) { //loopback connection
ldout(async_msgr->cct, 20) << __func__ << " " << *m << " local" << dendl;
std::lock_guard<std::mutex> l(write_lock);
if (protocol->is_connected()) {

View File

@ -392,6 +392,7 @@ public:
*/
void init_local_connection() {
Mutex::Locker l(lock);
local_connection->is_loopback = true;
_init_local_connection();
}