]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
AsyncConnection: Fix local message dispatch lack of source 5300/head
authorHaomai Wang <haomaiwang@gmail.com>
Tue, 21 Jul 2015 09:11:42 +0000 (17:11 +0800)
committerHaomai Wang <haomaiwang@gmail.com>
Tue, 21 Jul 2015 09:46:07 +0000 (17:46 +0800)
Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
src/msg/async/AsyncConnection.cc

index 2cec7fde0903b9da885964333a29118c726eaded..12a4c8d1e08ccdadfbb4c67eb8e6c24f7933ee8f 100644 (file)
@@ -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;