mirror of
https://github.com/ceph/ceph
synced 2024-12-28 14:34:13 +00:00
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:
commit
81268eb71d
@ -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) {
|
||||
}
|
||||
|
@ -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()) {
|
||||
|
@ -392,6 +392,7 @@ public:
|
||||
*/
|
||||
void init_local_connection() {
|
||||
Mutex::Locker l(lock);
|
||||
local_connection->is_loopback = true;
|
||||
_init_local_connection();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user