| 546 | } |
| 547 | |
| 548 | int 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 | |
| 600 | entity_addr_t AsyncConnection::_infer_target_addr(const entity_addrvec_t& av) |
| 601 | { |
nothing calls this directly
no test coverage detected