Loading src/cluster.cpp +7 −15 Changes for src/cluster.cpp: 7 added lines, 15 removed lines. Original line number Diff line number Diff line Loading @@ -224,21 +224,13 @@ namespace authdb { server_ = std::make_unique<paritypp::server>(scfg, store_, auth_); // Register peer status callback so GET_STATUS reports correct peer counts. // We use the config peer count as total, and probe each peer for online count. server_->set_peer_status_callback([this]() -> std::pair<uint32_t, uint32_t> { if (!pclient_) return {0, 0}; std::lock_guard<std::mutex> lock(client_mutex_); uint32_t total = static_cast<uint32_t>(cfg_.peers.size() - 1); // minus self uint32_t online = 0; // Quick probe: try get_node_status on each peer for (uint32_t i = 0; i < total; i++) { paritypp::status_info info; if (pclient_->get_node_status(i, info)) { online++; } } return {total, online}; // Register peer status callback so GET_STATUS reports peer counts. // This callback runs on the server thread when a remote node queries us, // so it must NOT acquire client_mutex_ or do network I/O (deadlock risk). // We report config-based peer count; live probing is done via admin API. size_t peer_count = cfg_.peers.size() > 0 ? cfg_.peers.size() - 1 : 0; server_->set_peer_status_callback([peer_count]() -> std::pair<uint32_t, uint32_t> { return {static_cast<uint32_t>(peer_count), static_cast<uint32_t>(peer_count)}; }); // Setup client for talking to peers — filter out self Loading Loading
src/cluster.cpp +7 −15 Changes for src/cluster.cpp: 7 added lines, 15 removed lines. Original line number Diff line number Diff line Loading @@ -224,21 +224,13 @@ namespace authdb { server_ = std::make_unique<paritypp::server>(scfg, store_, auth_); // Register peer status callback so GET_STATUS reports correct peer counts. // We use the config peer count as total, and probe each peer for online count. server_->set_peer_status_callback([this]() -> std::pair<uint32_t, uint32_t> { if (!pclient_) return {0, 0}; std::lock_guard<std::mutex> lock(client_mutex_); uint32_t total = static_cast<uint32_t>(cfg_.peers.size() - 1); // minus self uint32_t online = 0; // Quick probe: try get_node_status on each peer for (uint32_t i = 0; i < total; i++) { paritypp::status_info info; if (pclient_->get_node_status(i, info)) { online++; } } return {total, online}; // Register peer status callback so GET_STATUS reports peer counts. // This callback runs on the server thread when a remote node queries us, // so it must NOT acquire client_mutex_ or do network I/O (deadlock risk). // We report config-based peer count; live probing is done via admin API. size_t peer_count = cfg_.peers.size() > 0 ? cfg_.peers.size() - 1 : 0; server_->set_peer_status_callback([peer_count]() -> std::pair<uint32_t, uint32_t> { return {static_cast<uint32_t>(peer_count), static_cast<uint32_t>(peer_count)}; }); // Setup client for talking to peers — filter out self Loading