Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to receive messages from ceph SimpleMessenger Module

Shulou Source: shulou.com Published: 2022-05-31 18:42:25 09月14日 Update

Editor to share with you how to receive messages from the ceph SimpleMessenger module. I hope you will get something after reading this article. Let's discuss it together.

The reception of OSD server messages starts with the messenger::add_dispatcher_head (Dispatcher * d) function in OSD::init ().

| |-358 void add_dispatcher_head (Dispatcher * d) {| | 359 bool first = dispatchers.empty (); | | 360 dispatchers.push_front (d); | | 361 if (d-> ms_can_fast_dispatch_any ()) | | 362 fast_dispatchers.push_front (d); | | 363 if (first) | | 364 ready () | / / if dispatcher list is empty, start SimpleMessenger::ready. Not empty to prove that SimpleMessenger has been started | | 365}

In SimpleMessenger::ready (), start DispatchQueue to wait for mqueue, and start the accepter receive thread if the port is bound

76 void SimpleMessenger::ready ()-77 {| 78 ldout (cct,10) reader (); return 0;} | 53} reader_thread

In the Pipe::reader function, different types of messages are received according to tag. If it is a CEPH_MSGR_TAG_MSG type message, call read_message to receive the message and add the message to the mqueue.

Void Pipe::reader () {pipe_lock.Lock (); if (state = = STATE_ACCEPTING) {accept (); / / enter this function for the first time to process assert (pipe_lock.is_locked ());} / / loop. While (state! = STATE_CLOSED & & state! = STATE_CONNECTING) {assert (pipe_lock.is_locked ());. . Else if (tag = = CEPH_MSGR_TAG_MSG) {ldout (msgr- > cct,20) cct,10) cct- > _ conf- > ms_inject_delay_max * (double) (rand ()% 10000) / 10000.0; lsubdout (msgr- > cct, ms, 1)

Tags: Messages functions threads modules articles types processing different done data more knowledge ports first time industry information information channels channels China and Canada services Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Linux Apple Xiaomi MariaDB