return 0;
}
-void AsyncMessenger::dump(Formatter* f) {
+void AsyncMessenger::dump(
+ Formatter* f, std::function<bool(const std::string&)> filter) const {
+ const bool tcp_info = filter("tcp_info");
std::lock_guard l{lock};
f->dump_unsigned("nonce", nonce);
f->open_object_section("my_name");
my_addrs->dump(f);
f->close_section(); // my_addrs
- f->open_array_section("listen_sockets");
- for (const auto& proc : processors) {
- for (const auto& sock : proc->listen_sockets) {
- f->open_object_section("socket");
- f->dump_int("socket_fd", sock.fd());
+ if (filter("listen_sockets")) {
+ f->open_array_section("listen_sockets");
+ for (const auto& proc : processors) {
+ for (const auto& sock : proc->listen_sockets) {
+ f->open_object_section("socket");
+ f->dump_int("socket_fd", sock.fd());
- f->dump_int("worker_id", proc->worker ? proc->worker->id : -1);
- f->close_section(); // socket
+ f->dump_int("worker_id", proc->worker ? proc->worker->id : -1);
+ f->close_section(); // socket
+ }
}
+ f->close_section(); // listen_sockets
}
- f->close_section(); // listen_sockets
f->open_object_section("dispatch_queue");
f->dump_int("length", get_dispatch_queue_len());
f->dump_int("connections_count", conns.size());
- f->open_array_section("connections");
- for (const auto& [e, c] : conns) {
- f->open_object_section("connection");
- e.dump(f);
- c->dump(f);
- f->close_section(); // connection
+ if (filter("connections")) {
+ f->open_array_section("connections");
+ for (const auto& [e, c] : conns) {
+ f->open_object_section("connection");
+ e.dump(f);
+ c->dump(f, tcp_info);
+ f->close_section(); // connection
+ }
+ f->close_section(); // connections
}
- f->close_section(); // connections
- f->open_array_section("anon_conns");
- for (const auto& c : anon_conns) {
- c->dump(f);
+ if (filter("anon_conns")) {
+ f->open_array_section("anon_conns");
+ for (const auto& c : anon_conns) {
+ c->dump(f, tcp_info);
+ }
+ f->close_section(); // anon_conns
}
- f->close_section(); // anon_conns
- f->open_array_section("accepting_conns");
- for (const auto& c : accepting_conns) {
- c->dump(f);
+ if (filter("accepting_conns")) {
+ f->open_array_section("accepting_conns");
+ for (const auto& c : accepting_conns) {
+ c->dump(f, tcp_info);
+ }
+ f->close_section(); // accepting_conns
}
- f->close_section();
- f->open_array_section("deleted_conns");
- for (const auto& c : deleted_conns) {
- c->dump(f);
+ if (filter("deleted_conns")) {
+ f->open_array_section("deleted_conns");
+ for (const auto& c : deleted_conns) {
+ c->dump(f, tcp_info);
+ }
+ f->close_section(); // deleted_conns
}
- f->close_section(); // deleted_conns
if (local_connection) {
f->open_array_section("local_connection");
- local_connection->dump(f);
+ local_connection->dump(f, tcp_info);
f->close_section(); // local_connection
}
}
*/
bool set_addr_unknowns(const entity_addrvec_t &addr) override;
- int get_dispatch_queue_len() override {
+ int get_dispatch_queue_len() const override {
return dispatch_queue.get_queue_len();
}
- double get_dispatch_queue_max_age(utime_t now) override {
+ double get_dispatch_queue_max_age(utime_t now) const override {
return dispatch_queue.get_max_age(now);
}
/** @} Accessors */
void wait() override;
int shutdown() override;
- void dump(Formatter* f) override;
+ void dump(
+ Formatter* f, std::function<bool(const std::string&)> filter =
+ [](const std::string&) { return true; }) const override;
/** @} // Startup/Shutdown */
std::string ms_type;
/// overall lock used for AsyncMessenger data structures
- ceph::mutex lock = ceph::make_mutex("AsyncMessenger::lock");
+ mutable ceph::mutex lock = ceph::make_mutex("AsyncMessenger::lock");
// AsyncMessenger stuff
/// approximately unique ID set by the Constructor for use in entity_addr_t
uint64_t nonce;