Commit 272785c9 authored by jan.koester's avatar jan.koester
Browse files

tes

parent dcd2da44
Loading
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -442,12 +442,8 @@ const authdb::SessionData *authdb::ClusterSession::addSession(AuthBackend &backe
            imported->_username = cluster_username;
            imported->setGPOResults(cluster_gpo);

            // Ensure sid_gid entry exists — it may have been lost
            try {
                g_Cluster->pushSession(*imported);
            } catch (const std::exception &e) {
                std::cerr << "[SESSION] addSession: re-push of existing session FAILED: " << e.what() << std::endl;
            }
            // Ensure sid_gid entry exists — queue async to avoid blocking on dead nodes
            g_Cluster->queuePush(*imported);

            std::lock_guard<std::mutex> guard(_lock);
            removeLocal(cluster_sid);
@@ -492,10 +488,19 @@ const authdb::SessionData *authdb::ClusterSession::addSession(AuthBackend &backe
const authdb::SessionData *authdb::ClusterSession::getSession(uuid::uuid sessionid){
    if (!g_Cluster || !g_Cluster->isRunning())
        return nullptr;

    // Check local cache first (covers the gap until async queuePush completes)
    {
        std::lock_guard<std::mutex> guard(_lock);
        SessionData *local = findLocal(sessionid);
        if (local)
            return local;
    }

    if (g_Cluster->isCritical())
        return nullptr;

    // Fetch directly from cluster — single source of truth
    // Fetch from cluster
    uuid::uuid sid, uid, did;
    std::vector<uuid::uuid> members;
    std::string username;