Mutex::Locker l(write_lock);
// "features" changes will change the payload encoding
- if (can_write == NOWRITE || get_features() != f) {
+ if (can_fast_prepare && (can_write == NOWRITE || get_features() != f)) {
// ensure the correctness of message encoding
bl.clear();
m->get_payload().clear();
m->get();
}
+ m->calc_header_crc();
+
+ ceph_msg_header& header = m->get_header();
+ ceph_msg_footer& footer = m->get_footer();
+
+ // TODO: let sign_message could be reentry?
+ // Now that we have all the crcs calculated, handle the
+ // digital signature for the message, if the AsyncConnection has session
+ // security set up. Some session security options do not
+ // actually calculate and check the signature, but they should
+ // handle the calls to sign_message and check_signature. PLR
+ if (session_security.get() == NULL) {
+ ldout(async_msgr->cct, 20) << __func__ << " no session security" << dendl;
+ } else {
+ if (session_security->sign_message(m)) {
+ ldout(async_msgr->cct, 20) << __func__ << " failed to sign m="
+ << m << "): sig = " << footer.sig << dendl;
+ } else {
+ ldout(async_msgr->cct, 20) << __func__ << " signed m=" << m
+ << "): sig = " << footer.sig << dendl;
+ }
+ }
+
bufferlist complete_bl;
// send tag
char tag = CEPH_MSGR_TAG_MSG;
complete_bl.append(&tag, sizeof(tag));
- m->calc_header_crc();
- ceph_msg_header& header = m->get_header();
- ceph_msg_footer& footer = m->get_footer();
if (has_feature(CEPH_FEATURE_NOSRCADDR)) {
complete_bl.append((char*)&header, sizeof(header));
} else {
oldheader.src.addr = get_peer_addr();
oldheader.orig_src = oldheader.src;
oldheader.reserved = header.reserved;
- // delay crc calculate to "inject_msg_header_crc"
oldheader.crc = ceph_crc32c(0, (unsigned char*)&oldheader,
sizeof(oldheader) - sizeof(oldheader.crc));
complete_bl.append((char*)&oldheader, sizeof(oldheader));
complete_bl.claim_append(bl);
- // TODO: let sign_message could be reentry?
- // Now that we have all the crcs calculated, handle the
- // digital signature for the message, if the AsyncConnection has session
- // security set up. Some session security options do not
- // actually calculate and check the signature, but they should
- // handle the calls to sign_message and check_signature. PLR
- if (session_security.get() == NULL) {
- ldout(async_msgr->cct, 20) << __func__ << " no session security" << dendl;
- } else {
- if (session_security->sign_message(m)) {
- ldout(async_msgr->cct, 20) << __func__ << " failed to sign m="
- << m << "): sig = " << footer.sig << dendl;
- } else {
- ldout(async_msgr->cct, 20) << __func__ << " signed m=" << m
- << "): sig = " << footer.sig << dendl;
- }
- }
-
// send footer; if receiver doesn't support signatures, use the old footer format
ceph_msg_footer_old old_footer;
if (has_feature(CEPH_FEATURE_MSG_AUTH)) {