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

Example Analysis of Ceph Network Module Code

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

Share

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

This article mainly shows you the "Ceph network module code example analysis", the content is simple and easy to understand, clear organization, I hope to help you solve doubts, let Xiaobian lead you to study and learn "Ceph network module code example analysis" this article bar.

1. Messenger *ms_public = Messenger::create(g_ceph_context, entity_name_t::OSD(whoami), "client", getpid());

The ms_public instance is just one of several Messenger instances created by this function. From this function parameter "client" can also see some clues, indicating that this Messenger is specifically used for

Handling messages from "clients," where clients refer to clients such as RGW, RBD. ms_cluster handles messages with other OSD.

2. Binding ports and addresses

Then later, just like Linux Socket programming, here also need to call bind() function to complete the port and address binding, but here bind() function is specially packaged.

ms_public->bind(g_conf->public_addr);

Messenger is an abstract class and ms_public is a pointer to the base class.

The SimpleMessenger class inherits from Messenger.

The bind() function that is finally called is a subclass SimpleMessenger::bind(const entity_addr_t &bind_addr)

int SimpleMessenger::bind(const entity_addr_t &bind_addr){ lock.Lock(); if (started) { ldout(cct,10) = 0) ::close(p->sd); ldout(cct,10)

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