Commit 6557d939 authored by jan.koester's avatar jan.koester
Browse files

test

parent 63100b2b
Loading
Loading
Loading
Loading
Loading
+22 −0
Changes for src/session.cpp: 22 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -445,6 +445,28 @@ const authdb::SessionData *authdb::ClusterSession::addSession(AuthBackend &backe
    // Synchronous push to cluster — blocks until stored
    if (g_Cluster && g_Cluster->isRunning()) {
        g_Cluster->pushSession(*newSession);

        // Verify session is retrievable from cluster before returning.
        // This ensures other nodes can serve the session immediately.
        uuid::uuid newSid;
        newSession->getSid(newSid);
        auto deadline = std::chrono::steady_clock::now() + std::chrono::seconds(5);
        bool verified = false;
        while (std::chrono::steady_clock::now() < deadline) {
            uuid::uuid v_sid, v_uid, v_did;
            std::vector<uuid::uuid> v_members;
            std::string v_username;
            std::vector<std::pair<uuid::uuid, bool>> v_gpo;
            if (g_Cluster->fetchSessionBySid(newSid, v_sid, v_uid, v_did,
                                              v_members, v_username, v_gpo)) {
                verified = true;
                break;
            }
            std::this_thread::sleep_for(std::chrono::milliseconds(100));
        }
        if (!verified) {
            std::cerr << "[SESSION] addSession: WARNING — session pushed but not verifiable from cluster" << std::endl;
        }
    }

    {