summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAlexander Gavriliuk <alexandrgproductengine@lindenlab.com>2024-07-14 12:01:30 +0200
committerGuru <alexandrgproductengine@lindenlab.com>2024-07-18 09:42:59 +0200
commitef9a494134458f3464b250c87da9e247d775989c (patch)
tree12bc85b249dbc9a16afe3d4ded58983f4c154ed0 /indra
parent88f52f1b90af1813dc70525f2e08b16cc5939af5 (diff)
#1500 Better out of disk space handling
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llapp.cpp27
-rw-r--r--indra/llcommon/llapp.h4
-rw-r--r--indra/llcommon/llapr.cpp7
-rw-r--r--indra/newview/llappviewer.cpp7
-rw-r--r--indra/newview/llappviewer.h2
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml9
6 files changed, 55 insertions, 1 deletions
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index b85bd2573b..c2158bb5b8 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -487,6 +487,33 @@ int LLApp::getPid()
#endif
}
+// static
+void LLApp::notifyOutOfDiskSpace()
+{
+ static const U32Seconds min_interval = U32Seconds(60);
+ static U32Seconds min_time_to_send = U32Seconds(0);
+ U32Seconds now = LLTimer::getTotalTime();
+ if (now < min_time_to_send)
+ return;
+
+ min_time_to_send = now + min_interval;
+
+ if (LLApp* app = instance())
+ {
+ app->sendOutOfDiskSpaceNotification();
+ }
+ else
+ {
+ LL_WARNS() << "No app instance" << LL_ENDL;
+ }
+}
+
+// virtual
+void LLApp::sendOutOfDiskSpaceNotification()
+{
+ LL_WARNS() << "Should never be called" << LL_ENDL; // Should be overridden
+}
+
#ifndef LL_WINDOWS
void setup_signals()
{
diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h
index ad8912ca88..d90ecdf661 100644
--- a/indra/llcommon/llapp.h
+++ b/indra/llcommon/llapp.h
@@ -202,6 +202,8 @@ public:
static bool isExiting(); // Either quitting or error (app is exiting, cleanly or not)
static int getPid();
+ static void notifyOutOfDiskSpace();
+
//
// Sleep for specified time while still running
//
@@ -301,6 +303,8 @@ protected:
*/
void stepFrame();
+ virtual void sendOutOfDiskSpaceNotification();
+
private:
// Contains the filename of the minidump file after a crash.
char mMinidumpPath[MAX_MINDUMP_PATH_LENGTH];
diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp
index b085f8f5dc..01763c49aa 100644
--- a/indra/llcommon/llapr.cpp
+++ b/indra/llcommon/llapr.cpp
@@ -28,6 +28,7 @@
#include "linden_common.h"
#include "llapr.h"
+#include "llapp.h"
#include "llmutex.h"
#include "apr_dso.h"
@@ -606,7 +607,11 @@ S32 LLAPRFile::writeEx(const std::string& filename, const void *buf, S32 offset,
apr_status_t s = apr_file_write(file_handle, buf, &bytes_written);
if (s != APR_SUCCESS)
{
- LL_WARNS("APR") << " Attempting to write filename: " << filename << LL_ENDL;
+ LL_WARNS("APR") << "Attempting to write filename: " << filename << LL_ENDL;
+ if (APR_STATUS_IS_ENOSPC(s))
+ {
+ LLApp::notifyOutOfDiskSpace();
+ }
ll_apr_warn_status(s);
bytes_written = 0;
}
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index a10ef451e1..b380b09129 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3067,6 +3067,13 @@ bool LLAppViewer::meetsRequirementsForMaximizedStart()
return maximizedOk;
}
+// virtual
+void LLAppViewer::sendOutOfDiskSpaceNotification()
+{
+ LL_WARNS() << "Out of disk space notification requested" << LL_ENDL;
+ LLNotificationsUtil::add("OutOfDiskSpace");
+}
+
bool LLAppViewer::initWindow()
{
LL_INFOS("AppInit") << "Initializing window..." << LL_ENDL;
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 32d3df4f83..417ab0fa00 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -245,6 +245,8 @@ protected:
virtual bool meetsRequirementsForMaximizedStart(); // Used on first login to decide to launch maximized
+ virtual void sendOutOfDiskSpaceNotification();
+
private:
bool doFrame();
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index a1e25f48ed..3ba4f2f3e4 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -3032,6 +3032,15 @@ This is usually a temporary failure. Please customize and save the wearable agai
</notification>
<notification
+ icon="notifytip.tga"
+ name="OutOfDiskSpace"
+ type="notifytip">
+The system is out of disk space. You will need to free up some space on your computer or clear the cache.
+<tag>fail</tag>
+ <unique/>
+ </notification>
+
+ <notification
icon="alertmodal.tga"
name="YouHaveBeenLoggedOut"
type="alertmodal">