diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-01-21 22:32:13 +0200 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-01-22 16:06:30 +0200 |
commit | 01bd15d4be5b59cca8d49bb29eb9368c80b53f13 (patch) | |
tree | 825393709cc30909804a044d202d1eb3eaa0c82f /indra/newview | |
parent | de1ff0bd10886a7f3bf6aa8f0e4d25cdcfa27038 (diff) |
#3431 Include session id with last exec event
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 63 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 6 | ||||
-rw-r--r-- | indra/newview/lllogininstance.cpp | 1 | ||||
-rw-r--r-- | indra/newview/lllogininstance.h | 2 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 2 |
5 files changed, 63 insertions, 11 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 4b21905d88..64a4503260 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -298,6 +298,7 @@ bool gUseQuickTime = true; eLastExecEvent gLastExecEvent = LAST_EXEC_NORMAL; S32 gLastExecDuration = -1; // (<0 indicates unknown) +LLUUID gLastAgentSessionId; #if LL_WINDOWS # define LL_PLATFORM_KEY "win" @@ -3745,7 +3746,50 @@ bool LLAppViewer::markerIsSameVersion(const std::string& marker_name) const return sameVersion; } -S32 LLAppViewer::getMarkerData(const std::string& marker_name) const +void LLAppViewer::recordSessionToMarker() +{ + std::string marker_version(LLVersionInfo::instance().getChannelAndVersion()); + std::string uuid_str = "\n" + gAgentSessionID.asString(); + if (marker_version.length() + uuid_str.length() > MAX_MARKER_LENGTH) + { + LL_WARNS_ONCE("MarkerFile") << "Version length (" << marker_version.length() << ")" + << " greater than maximum (" << MAX_MARKER_LENGTH << ")" + << ": marker matching may be incorrect" + << LL_ENDL; + } + + mMarkerFile.seek(APR_SET, (S32)marker_version.length()); + mMarkerFile.write(uuid_str.data(), (S32)uuid_str.length()); +} + +LLUUID LLAppViewer::getMarkerSessionId(const std::string& marker_name) const +{ + std::string data; + if (getMarkerData(marker_name, data)) + { + return LLUUID(data); + } + return LLUUID(); +} + +S32 LLAppViewer::getMarkerErrorCode(const std::string& marker_name) const +{ + std::string data; + if (getMarkerData(marker_name, data)) + { + if (data.empty()) + { + return 0; + } + else + { + return std::stoi(data); + } + } + return -1; +} + +bool LLAppViewer::getMarkerData(const std::string& marker_name, std::string& data) const { bool sameVersion = false; @@ -3760,7 +3804,6 @@ S32 LLAppViewer::getMarkerData(const std::string& marker_name) const marker_version_length = marker_file.read(marker_data, sizeof(marker_data)); marker_file.close(); std::string marker_string(marker_data, marker_version_length); - std::string data; size_t pos = marker_string.find('\n'); if (pos != std::string::npos) { @@ -3773,20 +3816,16 @@ S32 LLAppViewer::getMarkerData(const std::string& marker_name) const } else { - return -1; + return false; } LL_DEBUGS("MarkerFile") << "Compare markers for '" << marker_name << "': " << "\n mine '" << my_version << "'" << "\n marker '" << marker_string << "'" << "\n " << (sameVersion ? "same" : "different") << " version" << LL_ENDL; - if (data.length() == 0) - { - return 0; - } - return std::stoi(data); + return true; } - return -1; + return false; } void LLAppViewer::processMarkerFiles() @@ -3807,6 +3846,10 @@ void LLAppViewer::processMarkerFiles() // File exists... // first, read it to see if it was created by the same version (we need this later) marker_is_same_version = markerIsSameVersion(mMarkerFileName); + if (marker_is_same_version) + { + gLastAgentSessionId = getMarkerSessionId(mMarkerFileName); + } // now test to see if this file is locked by a running process (try to open for write) marker_log_stream << "Checking exec marker file for lock..."; @@ -3923,7 +3966,7 @@ void LLAppViewer::processMarkerFiles() std::string error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME); if(LLAPRFile::isExist(error_marker_file, NULL, LL_APR_RB)) { - S32 marker_code = getMarkerData(error_marker_file); + S32 marker_code = getMarkerErrorCode(error_marker_file); if (marker_code >= 0) { if (gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 2432ae8641..b4756eecd6 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -161,6 +161,7 @@ public: void saveExperienceCache(); void removeMarkerFiles(); + void recordSessionToMarker(); void removeDumpDir(); // LLAppViewer testing helpers. @@ -289,7 +290,9 @@ private: void processMarkerFiles(); static void recordMarkerVersion(LLAPRFile& marker_file); bool markerIsSameVersion(const std::string& marker_name) const; - S32 getMarkerData(const std::string& marker_name) const; + LLUUID getMarkerSessionId(const std::string& marker_name) const; + S32 getMarkerErrorCode(const std::string& marker_name) const; + bool getMarkerData(const std::string& marker_name, std::string &data) const; void idle(); void idleShutdown(); @@ -367,6 +370,7 @@ extern bool gShowObjectUpdates; extern eLastExecEvent gLastExecEvent; // llstartup extern S32 gLastExecDuration; ///< the duration of the previous run in seconds (<0 indicates unknown) +extern LLUUID gLastAgentSessionId; // will be set if agent logged in extern const char* gPlatform; diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index ad04c11cc6..cbc3744aa3 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -212,6 +212,7 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia request_params["read_critical"] = false; // handleTOSResponse request_params["last_exec_event"] = mLastExecEvent; request_params["last_exec_duration"] = mLastExecDuration; + request_params["last_exec_session_id"] = mLastAgentSessionId.asString(); request_params["mac"] = (char*)hashed_unique_id_string; request_params["version"] = LLVersionInfo::instance().getVersion(); request_params["channel"] = LLVersionInfo::instance().getChannel(); diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h index 624408d46d..748909c069 100644 --- a/indra/newview/lllogininstance.h +++ b/indra/newview/lllogininstance.h @@ -64,6 +64,7 @@ public: void setSerialNumber(const std::string& sn) { mSerialNumber = sn; } void setLastExecEvent(int lee) { mLastExecEvent = lee; } void setLastExecDuration(S32 duration) { mLastExecDuration = duration; } + void setLastAgentSessionId(const LLUUID& id) { mLastAgentSessionId = id; } void setPlatformInfo(const std::string platform, const std::string platform_version, const std::string platform_name); void setNotificationsInterface(LLNotificationsInterface* ni) { mNotifications = ni; } @@ -101,6 +102,7 @@ private: std::string mSerialNumber; int mLastExecEvent; S32 mLastExecDuration; + LLUUID mLastAgentSessionId; std::string mPlatform; std::string mPlatformVersion; std::string mPlatformVersionName; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 3726a95f64..8ccd4f1dbf 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1045,6 +1045,7 @@ bool idle_startup() login->setSerialNumber(LLAppViewer::instance()->getSerialNumber()); login->setLastExecEvent(gLastExecEvent); login->setLastExecDuration(gLastExecDuration); + login->setLastAgentSessionId(gLastAgentSessionId); // This call to LLLoginInstance::connect() starts the // authentication process. @@ -3529,6 +3530,7 @@ bool process_login_success_response() text = response["session_id"].asString(); if(!text.empty()) gAgentSessionID.set(text); gDebugInfo["SessionID"] = text; + LLAppViewer::instance()->recordSessionToMarker(); // Session id needed for parcel info request in LLUrlEntryParcel // to resolve parcel name. |