MCPcopy Create free account
hub / github.com/ceph/ceph / send_message

Method send_message

src/msg/async/AsyncConnection.cc:548–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

546}
547
548int AsyncConnection::send_message(Message *m)
549{
550 FUNCTRACE(async_msgr->cct);
551 lgeneric_subdout(async_msgr->cct, ms,
552 1) << "-- " << async_msgr->get_myaddrs() << " --> "
553 << get_peer_addrs() << " -- "
554 << *m << " -- " << m << " con "
555 << this
556 << dendl;
557
558 if (is_blackhole()) {
559 lgeneric_subdout(async_msgr->cct, ms, 0) << __func__ << ceph_entity_type_name(peer_type)
560 << " blackhole " << *m << dendl;
561 m->put();
562 return 0;
563 }
564
565 // optimistic think it's ok to encode(actually may broken now)
566 if (!m->get_priority())
567 m->set_priority(async_msgr->get_default_send_priority());
568
569 m->get_header().src = async_msgr->get_myname();
570 m->set_connection(this);
571
572#if defined(WITH_EVENTTRACE)
573 if (m->get_type() == CEPH_MSG_OSD_OP)
574 OID_EVENT_TRACE_WITH_MSG(m, "SEND_MSG_OSD_OP_BEGIN", true);
575 else if (m->get_type() == CEPH_MSG_OSD_OPREPLY)
576 OID_EVENT_TRACE_WITH_MSG(m, "SEND_MSG_OSD_OPREPLY_BEGIN", true);
577#endif
578
579 if (is_loopback) { //loopback connection
580 ldout(async_msgr->cct, 20) << __func__ << " " << *m << " local" << dendl;
581 std::lock_guard<std::mutex> l(write_lock);
582 if (protocol->is_connected()) {
583 dispatch_queue->local_delivery(m, m->get_priority());
584 } else {
585 ldout(async_msgr->cct, 10) << __func__ << " loopback connection closed."
586 << " Drop message " << m << dendl;
587 m->put();
588 }
589 return 0;
590 }
591
592 // we don't want to consider local message here, it's too lightweight which
593 // may disturb users
594 logger->inc(l_msgr_send_messages);
595
596 protocol->send_message(m);
597 return 0;
598}
599
600entity_addr_t AsyncConnection::_infer_target_addr(const entity_addrvec_t& av)
601{

Callers

nothing calls this directly

Calls 13

ceph_entity_type_nameFunction · 0.85
get_mynameMethod · 0.80
get_myaddrsMethod · 0.45
putMethod · 0.45
get_priorityMethod · 0.45
set_priorityMethod · 0.45
get_headerMethod · 0.45
set_connectionMethod · 0.45
get_typeMethod · 0.45
is_connectedMethod · 0.45
local_deliveryMethod · 0.45

Tested by

no test coverage detected