diff options
| author | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-05-30 01:35:57 +0300 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-06-04 01:31:21 +0300 |
| commit | 1832026b5896968bac100e67235ad242a40f2157 (patch) | |
| tree | cd674130e91206bc1c9d5e031d31b63e742cf0a0 /indra/newview/llviewerwindow.cpp | |
| parent | 0797d76b7aec1e1b8fe45866cdb61147b3f531e5 (diff) | |
#5856 An option to prevent hibernation
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
| -rw-r--r-- | indra/newview/llviewerwindow.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index abd7096f50..4229ffcfb5 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1487,12 +1487,30 @@ void LLViewerWindow::handleCloseRequestCanceled() void LLViewerWindow::handleSuspendRequest() { - LLAppViewer::instance()->sendViewerStatistics(); - // Todo: this should send a disconnect request as viewer - // can't keep heartbeat up while suspended and will get - // disconnected within a minute. - // Add a disconnect here once 'prevent OS from sleeping' - // feature is ready. + static LLCachedControl<S32> os_hibernation_mode(gSavedSettings, "OSHibernationMode", 0); + if (os_hibernation_mode == 0) + { + LL_INFOS() << "Got a 'suspend' event from OS" << LL_ENDL; + // Viewer doesn't handle hibernation. + // Just send statistics. + LLAppViewer::instance()->sendViewerStatistics(false); + } + else + { + LL_INFOS() << "Got a 'suspend' event from OS, disconnecting" << LL_ENDL; + // Viewer is set to prevent hibernation if agent isn't away. + // If we got here, likely Agent 'went' away then viewer got + // a hibernation message. + // We have a limited timeframe. Sends stats then disconnect. + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + LLAppViewer::instance()->sendViewerStatistics(true); + LLAppViewer::instance()->metricsSend(!gDisconnected); + // Make sure to show a message. + LLAppViewer::instance()->forceDisconnect(LLTrans::getString("YouHaveBeenDisconnected")); + } + } } bool LLViewerWindow::handleCloseRequest(LLWindow *window, bool from_user) |
