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

Method send_message

src/msg/async/ProtocolV2.cc:434–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434void ProtocolV2::send_message(Message *m) {
435 uint64_t f = connection->get_features();
436
437 // TODO: Currently not all messages supports reencode like MOSDMap, so here
438 // only let fast dispatch support messages prepare message
439 const bool can_fast_prepare = messenger->ms_can_fast_dispatch(m);
440 bool is_prepared;
441 if (can_fast_prepare && f) {
442 prepare_send_message(f, m);
443 is_prepared = can_fast_prepare;
444 } else {
445 is_prepared = false;
446 }
447
448 std::lock_guard<std::mutex> l(connection->write_lock);
449 // "features" changes will change the payload encoding
450 if (can_fast_prepare && (!can_write || connection->get_features() != f)) {
451 // ensure the correctness of message encoding
452 m->clear_payload();
453 is_prepared = false;
454 ldout(cct, 10) << __func__ << " clear encoded buffer previous " << f
455 << " != " << connection->get_features() << dendl;
456 }
457 if (state == CLOSED) {
458 ldout(cct, 10) << __func__ << " connection closed."
459 << " Drop message " << m << dendl;
460 m->put();
461 } else {
462 ldout(cct, 5) << __func__ << " enqueueing message m=" << m
463 << " type=" << m->get_type() << " " << *m << dendl;
464 m->queue_start = ceph::mono_clock::now();
465 m->trace.event("async enqueueing message");
466 out_queue[m->get_priority()].emplace_back(
467 out_queue_entry_t{is_prepared, m});
468 ldout(cct, 15) << __func__ << " message queued for async transmission m=" << m
469 << dendl;
470 if (((!replacing && can_write) || state == STANDBY) && !write_in_progress) {
471 write_in_progress = true;
472 connection->center->dispatch_event_external(connection->write_handler);
473 }
474 }
475}
476
477void ProtocolV2::send_keepalive() {
478 ldout(cct, 10) << __func__ << dendl;

Callers 1

send_toMethod · 0.45

Calls 10

clear_payloadMethod · 0.80
nowFunction · 0.50
get_featuresMethod · 0.45
ms_can_fast_dispatchMethod · 0.45
putMethod · 0.45
get_typeMethod · 0.45
eventMethod · 0.45
emplace_backMethod · 0.45
get_priorityMethod · 0.45

Tested by

no test coverage detected