From: Haomai Wang Date: Tue, 21 Jul 2015 09:11:42 +0000 (+0800) Subject: AsyncConnection: Fix local message dispatch lack of source X-Git-Tag: v9.1.0~505^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8f33dc3cc57fab51f70a7a2d4c31f6658974ace9;p=ceph.git AsyncConnection: Fix local message dispatch lack of source Signed-off-by: Haomai Wang --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index 2cec7fde0903..12a4c8d1e08c 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -1920,6 +1920,13 @@ int AsyncConnection::send_message(Message *m) { ldout(async_msgr->cct, 10) << __func__ << " m=" << m << dendl; + // optimistic think it's ok to encode(actually may broken now) + if (!m->get_priority()) + m->set_priority(async_msgr->get_default_send_priority()); + + m->get_header().src = async_msgr->get_myname(); + m->set_connection(this); + if (async_msgr->get_myaddr() == get_peer_addr()) { //loopback connection ldout(async_msgr->cct, 20) << __func__ << " " << *m << " local" << dendl; Mutex::Locker l(write_lock); @@ -1935,10 +1942,6 @@ int AsyncConnection::send_message(Message *m) bufferlist bl; uint64_t f = get_features(); - // optimistic think it's ok to encode(actually may broken now) - if (!m->get_priority()) - m->set_priority(async_msgr->get_default_send_priority()); - // TODO: Currently not all messages supports reencode like MOSDMap, so here // only let fast dispatch support messages prepare message bool can_fast_prepare = async_msgr->ms_can_fast_dispatch(m); @@ -2185,8 +2188,6 @@ void AsyncConnection::prepare_send_message(uint64_t features, Message *m, buffer ldout(async_msgr->cct, 20) << __func__ << " m" << " " << *m << dendl; // associate message with Connection (for benefit of encode_payload) - m->get_header().src = async_msgr->get_myname(); - m->set_connection(this); if (m->empty_payload()) ldout(async_msgr->cct, 20) << __func__ << " encoding features " << features << " " << m << " " << *m << dendl;