Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to receive messages from ceph SimpleMessenger Module

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report