| 526 | } |
| 527 | |
| 528 | ssize_t ProtocolV2::write_message(Message *m, bool more) { |
| 529 | FUNCTRACE(cct); |
| 530 | ceph_assert(connection->center->in_thread()); |
| 531 | m->set_seq(++out_seq); |
| 532 | |
| 533 | connection->lock.lock(); |
| 534 | uint64_t ack_seq = in_seq; |
| 535 | ack_left = 0; |
| 536 | connection->lock.unlock(); |
| 537 | |
| 538 | ceph_msg_header &header = m->get_header(); |
| 539 | ceph_msg_footer &footer = m->get_footer(); |
| 540 | |
| 541 | ceph_msg_header2 header2{header.seq, header.tid, |
| 542 | header.type, header.priority, |
| 543 | header.version, |
| 544 | ceph_le32(0), header.data_off, |
| 545 | ceph_le64(ack_seq), |
| 546 | footer.flags, header.compat_version, |
| 547 | header.reserved}; |
| 548 | |
| 549 | auto message = MessageFrame::Encode( |
| 550 | header2, |
| 551 | m->get_payload(), |
| 552 | m->get_middle(), |
| 553 | m->get_data()); |
| 554 | if (!append_frame(message)) { |
| 555 | m->put(); |
| 556 | return -EILSEQ; |
| 557 | } |
| 558 | |
| 559 | ldout(cct, 2) << __func__ << " sending message m=" << m |
| 560 | << " seq=" << m->get_seq() << " " << *m << dendl; |
| 561 | |
| 562 | m->trace.event("async writing message"); |
| 563 | ldout(cct, 20) << __func__ << " sending m=" << m << " seq=" << m->get_seq() |
| 564 | << " src=" << entity_name_t(messenger->get_myname()) |
| 565 | << " off=" << header2.data_off |
| 566 | << dendl; |
| 567 | ssize_t total_send_size = connection->outgoing_bl.length(); |
| 568 | ssize_t rc = connection->_try_send(more); |
| 569 | if (rc < 0) { |
| 570 | ldout(cct, 1) << __func__ << " error sending " << m << ", " |
| 571 | << cpp_strerror(rc) << dendl; |
| 572 | } else { |
| 573 | const auto sent_bytes = total_send_size - connection->outgoing_bl.length(); |
| 574 | connection->logger->inc(l_msgr_send_bytes, sent_bytes); |
| 575 | if (session_stream_handlers.tx) { |
| 576 | connection->logger->inc(l_msgr_send_encrypted_bytes, sent_bytes); |
| 577 | } |
| 578 | ldout(cct, 10) << __func__ << " sending " << m |
| 579 | << (rc ? " continuely." : " done.") << dendl; |
| 580 | } |
| 581 | |
| 582 | #if defined(WITH_EVENTTRACE) |
| 583 | if (m->get_type() == CEPH_MSG_OSD_OP) |
| 584 | OID_EVENT_TRACE_WITH_MSG(m, "SEND_MSG_OSD_OP_END", false); |
| 585 | else if (m->get_type() == CEPH_MSG_OSD_OPREPLY) |
nothing calls this directly
no test coverage detected