Loading src/cluster.cpp +8 −8 Changes for src/cluster.cpp: 8 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -392,7 +392,7 @@ namespace authdb { // Replicate raw data to all peer nodes under both keys try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); pclient_->replicate_to_peers(sgid, 0, data.data(), data.size()); pclient_->replicate_to_peers(sid_gid, 0, data.data(), data.size()); } catch (const netplus::NetException &e) { Loading Loading @@ -420,7 +420,7 @@ namespace authdb { // Try to fetch from peer nodes if (pclient_) { try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); if (pclient_->fetch_from_peers(sgid, 0, data) && !data.empty()) { uuid::uuid d_uid, d_did; if (SessionBlock::deserialize(data, sid, d_uid, d_did, members, username, gpo_results)) { Loading Loading @@ -452,7 +452,7 @@ namespace authdb { store_->remove_group(sid_gid); if (pclient_) { try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); pclient_->remove(sid_gid); } catch (...) {} } Loading @@ -464,7 +464,7 @@ namespace authdb { if (pclient_) { try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); pclient_->remove(sgid); } catch (...) {} } Loading @@ -480,7 +480,7 @@ namespace authdb { // Check peer nodes if (pclient_) { try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); if (pclient_->fetch_from_peers(sgid, 0, data) && !data.empty()) return true; } catch (...) {} Loading @@ -499,7 +499,7 @@ namespace authdb { // Check peer nodes if (pclient_) { try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); if (pclient_->fetch_from_peers(sid_gid, 0, data) && !data.empty()) return true; } catch (...) {} Loading @@ -526,7 +526,7 @@ namespace authdb { // Try to fetch from peer nodes if (pclient_) { try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); if (pclient_->fetch_from_peers(sid_gid, 0, data) && !data.empty()) { if (SessionBlock::deserialize(data, sid, uid, did, members, username, gpo_results)) { // Cache locally Loading Loading @@ -674,7 +674,7 @@ namespace authdb { // Replicate to all peer nodes try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); pclient_->replicate_to_peers(localId, 0, data.data(), data.size()); } catch (const netplus::NetException &e) { std::cerr << "Cluster replicate failed: " << e.what() << std::endl; Loading Loading
src/cluster.cpp +8 −8 Changes for src/cluster.cpp: 8 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -392,7 +392,7 @@ namespace authdb { // Replicate raw data to all peer nodes under both keys try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); pclient_->replicate_to_peers(sgid, 0, data.data(), data.size()); pclient_->replicate_to_peers(sid_gid, 0, data.data(), data.size()); } catch (const netplus::NetException &e) { Loading Loading @@ -420,7 +420,7 @@ namespace authdb { // Try to fetch from peer nodes if (pclient_) { try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); if (pclient_->fetch_from_peers(sgid, 0, data) && !data.empty()) { uuid::uuid d_uid, d_did; if (SessionBlock::deserialize(data, sid, d_uid, d_did, members, username, gpo_results)) { Loading Loading @@ -452,7 +452,7 @@ namespace authdb { store_->remove_group(sid_gid); if (pclient_) { try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); pclient_->remove(sid_gid); } catch (...) {} } Loading @@ -464,7 +464,7 @@ namespace authdb { if (pclient_) { try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); pclient_->remove(sgid); } catch (...) {} } Loading @@ -480,7 +480,7 @@ namespace authdb { // Check peer nodes if (pclient_) { try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); if (pclient_->fetch_from_peers(sgid, 0, data) && !data.empty()) return true; } catch (...) {} Loading @@ -499,7 +499,7 @@ namespace authdb { // Check peer nodes if (pclient_) { try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); if (pclient_->fetch_from_peers(sid_gid, 0, data) && !data.empty()) return true; } catch (...) {} Loading @@ -526,7 +526,7 @@ namespace authdb { // Try to fetch from peer nodes if (pclient_) { try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); if (pclient_->fetch_from_peers(sid_gid, 0, data) && !data.empty()) { if (SessionBlock::deserialize(data, sid, uid, did, members, username, gpo_results)) { // Cache locally Loading Loading @@ -674,7 +674,7 @@ namespace authdb { // Replicate to all peer nodes try { std::lock_guard<std::mutex> lock(client_mutex_); std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout"); pclient_->replicate_to_peers(localId, 0, data.data(), data.size()); } catch (const netplus::NetException &e) { std::cerr << "Cluster replicate failed: " << e.what() << std::endl; Loading