summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llcoproceduremanager.cpp45
-rw-r--r--indra/llmessage/llexperiencecache.cpp35
-rw-r--r--indra/llmessage/llexperiencecache.h11
-rw-r--r--indra/llmessage/llnamevalue.cpp1
-rw-r--r--indra/llmessage/llproxy.cpp6
-rw-r--r--indra/llmessage/message_prehash.cpp3
-rw-r--r--indra/llmessage/message_prehash.h3
-rw-r--r--indra/llmessage/patch_code.cpp1
-rw-r--r--indra/llmessage/patch_dct.cpp1
-rw-r--r--indra/llmessage/patch_idct.cpp1
10 files changed, 59 insertions, 48 deletions
diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp
index 263670bdac..5539ca7b86 100644
--- a/indra/llmessage/llcoproceduremanager.cpp
+++ b/indra/llmessage/llcoproceduremanager.cpp
@@ -307,25 +307,20 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size):
{
try
{
- // store in our LLTempBoundListener so that when the LLCoprocedurePool is
- // destroyed, we implicitly disconnect from this LLEventPump
- // Monitores application status
- mStatusListener = LLEventPumps::instance().obtain("LLApp").listen(
+ // Store in our LLTempBoundListener so that when the LLCoprocedurePool is
+ // destroyed, we implicitly disconnect from this LLEventPump.
+ // Monitors application status.
+ mStatusListener = LLCoros::getStopListener(
poolName + "_pool", // Make sure it won't repeat names from lleventcoro
- [pendingCoprocs = mPendingCoprocs, poolName](const LLSD& status)
- {
- auto& statsd = status["status"];
- if (statsd.asString() != "running")
+ [pendingCoprocs = mPendingCoprocs, poolName](const LLSD& event)
{
LL_INFOS("CoProcMgr") << "Pool " << poolName
- << " closing queue because status " << statsd
+ << " closing queue because status " << event
<< LL_ENDL;
// This should ensure that all waiting coprocedures in this
// pool will wake up and terminate.
pendingCoprocs->close();
- }
- return false;
- });
+ });
}
catch (const LLEventPump::DupListenerName &)
{
@@ -334,7 +329,7 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size):
//
// If this somehow happens again it is better to crash later on shutdown due to pump
// not stopping coroutine and see warning in logs than on startup or during login.
- LL_WARNS("CoProcMgr") << "Attempted to register dupplicate listener name: " << poolName
+ LL_WARNS("CoProcMgr") << "Attempted to register duplicate listener name: " << poolName
<< "_pool. Failed to start listener." << LL_ENDL;
llassert(0); // Fix Me! Ignoring missing listener!
@@ -408,6 +403,7 @@ void LLCoprocedurePool::coprocedureInvokerCoro(
CoprocQueuePtr pendingCoprocs,
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter)
{
+ std::string prevtask;
for (;;)
{
// It is VERY IMPORTANT that we instantiate a new ptr_t just before
@@ -429,10 +425,25 @@ void LLCoprocedurePool::coprocedureInvokerCoro(
// destroyed during pop_wait_for().
QueuedCoproc::ptr_t coproc;
boost::fibers::channel_op_status status;
+ // Each time control reaches our custom coroutine scheduler, we check
+ // how long the previous coroutine ran before yielding, and report
+ // coroutines longer than a certain cutoff. But these coprocedure pool
+ // coroutines are generic; the only way we know what work they're
+ // doing is the task 'status' set by LLCoros::setStatus(). But what if
+ // the coroutine runs the task to completion and returns to waiting?
+ // It does no good to report that "waiting" ran long. So each time we
+ // enter "waiting" status, also report the *previous* task name.
+ std::string waiting = "waiting", newstatus;
+ if (prevtask.empty())
+ {
+ newstatus = waiting;
+ }
+ else
{
- LLCoros::TempStatus st("waiting for work for 10s");
- status = pendingCoprocs->pop_wait_for(coproc, std::chrono::seconds(10));
+ newstatus = stringize("done ", prevtask, "; ", waiting);
}
+ LLCoros::setStatus(newstatus);
+ status = pendingCoprocs->pop_wait_for(coproc, std::chrono::seconds(10));
if (status == boost::fibers::channel_op_status::closed)
{
break;
@@ -441,6 +452,7 @@ void LLCoprocedurePool::coprocedureInvokerCoro(
if(status == boost::fibers::channel_op_status::timeout)
{
LL_DEBUGS_ONCE("CoProcMgr") << "pool '" << mPoolName << "' waiting." << LL_ENDL;
+ prevtask.clear();
continue;
}
// we actually popped an item
@@ -451,6 +463,9 @@ void LLCoprocedurePool::coprocedureInvokerCoro(
try
{
+ // set "status" of pool coroutine to the name of the coproc task
+ prevtask = coproc->mName;
+ LLCoros::setStatus(prevtask);
coproc->mProc(httpAdapter, coproc->mId);
}
catch (const LLCoros::Stop &e)
diff --git a/indra/llmessage/llexperiencecache.cpp b/indra/llmessage/llexperiencecache.cpp
index b5d0c93376..ea9475ed69 100644
--- a/indra/llmessage/llexperiencecache.cpp
+++ b/indra/llmessage/llexperiencecache.cpp
@@ -110,9 +110,8 @@ void LLExperienceCache::initSingleton()
LLCoprocedureManager::instance().initializePool("ExpCache");
- LLCoros::instance().launch("LLExperienceCache::idleCoro",
- boost::bind(&LLExperienceCache::idleCoro, this));
-
+ const F32 SECS_BETWEEN_REQUESTS = 0.5f;
+ mExpirationTimerHandle = LL::Timers::instance().scheduleEvery([this]() { expirationTimer(); return false; }, SECS_BETWEEN_REQUESTS);
}
void LLExperienceCache::cleanup()
@@ -125,6 +124,8 @@ void LLExperienceCache::cleanup()
cache_stream << (*this);
}
sShutdown = true;
+
+ LL::Timers::instance().cancel(mExpirationTimerHandle);
}
//-------------------------------------------------------------------------
@@ -392,30 +393,20 @@ void LLExperienceCache::setCapabilityQuery(LLExperienceCache::CapabilityQuery_t
}
-void LLExperienceCache::idleCoro()
+void LLExperienceCache::expirationTimer()
{
- const F32 SECS_BETWEEN_REQUESTS = 0.5f;
+ LL_PROFILE_ZONE_SCOPED;
const F32 ERASE_EXPIRED_TIMEOUT = 60.f; // seconds
- LL_INFOS("ExperienceCache") << "Launching Experience cache idle coro." << LL_ENDL;
- do
+ if (mEraseExpiredTimer.checkExpirationAndReset(ERASE_EXPIRED_TIMEOUT))
{
- if (mEraseExpiredTimer.checkExpirationAndReset(ERASE_EXPIRED_TIMEOUT))
- {
- eraseExpired();
- }
-
- if (!mRequestQueue.empty())
- {
- requestExperiences();
- }
-
- llcoro::suspendUntilTimeout(SECS_BETWEEN_REQUESTS);
-
- } while (!sShutdown);
+ eraseExpired();
+ }
- // The coroutine system will likely be shut down by the time we get to this point
- // (or at least no further cycling will occur on it since the user has decided to quit.)
+ if (!mRequestQueue.empty())
+ {
+ requestExperiences();
+ }
}
void LLExperienceCache::erase(const LLUUID& key)
diff --git a/indra/llmessage/llexperiencecache.h b/indra/llmessage/llexperiencecache.h
index 81e904107f..b10c24efe4 100644
--- a/indra/llmessage/llexperiencecache.h
+++ b/indra/llmessage/llexperiencecache.h
@@ -30,10 +30,13 @@
#define LL_LLEXPERIENCECACHE_H
#include "linden_common.h"
-#include "llsingleton.h"
+
+#include "llcallbacklist.h" // LL::Timers::handle_t
+#include "llcorehttputil.h"
#include "llframetimer.h"
+#include "llsingleton.h"
#include "llsd.h"
-#include "llcorehttputil.h"
+
#include <boost/signals2.hpp>
#include <boost/function.hpp>
@@ -144,7 +147,9 @@ private:
std::string mCacheFileName;
static bool sShutdown; // control for coroutines, they exist out of LLExperienceCache's scope, so they need a static control
- void idleCoro();
+ LL::Timers::handle_t mExpirationTimerHandle;
+ void expirationTimer();
+
void eraseExpired();
void requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, std::string, RequestQueue_t);
void requestExperiences();
diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp
index 853ae7df82..05ea3f26a1 100644
--- a/indra/llmessage/llnamevalue.cpp
+++ b/indra/llmessage/llnamevalue.cpp
@@ -967,4 +967,3 @@ std::ostream& operator<<(std::ostream& s, const LLNameValue &a)
}
return s;
}
-
diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp
index 864e68998c..d713cb20d9 100644
--- a/indra/llmessage/llproxy.cpp
+++ b/indra/llmessage/llproxy.cpp
@@ -465,7 +465,7 @@ void LLProxy::applyProxySettings(CURL* handle)
/**
* @brief Send one TCP packet and receive one in return.
*
- * This operation is done synchronously with a 1000ms timeout. Therefore, it should not be used when a blocking
+ * This operation is done synchronously with a 100ms timeout. Therefore, it should not be used when a blocking
* operation would impact the operation of the viewer.
*
* @param handle_ptr Pointer to a connected LLSocket of type STREAM_TCP.
@@ -482,7 +482,7 @@ static apr_status_t tcp_blocking_handshake(LLSocket::ptr_t handle, char * dataou
apr_size_t expected_len = outlen;
- handle->setBlocking(1000);
+ handle->setBlocking(100000); // 100ms, 100000us. Should be sufficient for localhost, nearby network
rv = apr_socket_send(apr_socket, dataout, &outlen);
if (APR_SUCCESS != rv)
@@ -498,8 +498,6 @@ static apr_status_t tcp_blocking_handshake(LLSocket::ptr_t handle, char * dataou
rv = -1;
}
- ms_sleep(1);
-
if (APR_SUCCESS == rv)
{
expected_len = maxinlen;
diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp
index c264a9f086..7ab25908e2 100644
--- a/indra/llmessage/message_prehash.cpp
+++ b/indra/llmessage/message_prehash.cpp
@@ -1402,3 +1402,6 @@ char const* const _PREHASH_HoverHeight = LLMessageStringTable::getInstance()->ge
char const* const _PREHASH_Experience = LLMessageStringTable::getInstance()->getString("Experience");
char const* const _PREHASH_ExperienceID = LLMessageStringTable::getInstance()->getString("ExperienceID");
char const* const _PREHASH_LargeGenericMessage = LLMessageStringTable::getInstance()->getString("LargeGenericMessage");
+char const* const _PREHASH_GameControlInput = LLMessageStringTable::getInstance()->getString("GameControlInput");
+char const* const _PREHASH_AxisData = LLMessageStringTable::getInstance()->getString("AxisData");
+char const* const _PREHASH_MetaData = LLMessageStringTable::getInstance()->getString("MetaData");
diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h
index 1d30b69b67..88dee7f961 100644
--- a/indra/llmessage/message_prehash.h
+++ b/indra/llmessage/message_prehash.h
@@ -1403,5 +1403,8 @@ extern char const* const _PREHASH_HoverHeight;
extern char const* const _PREHASH_Experience;
extern char const* const _PREHASH_ExperienceID;
extern char const* const _PREHASH_LargeGenericMessage;
+extern char const* const _PREHASH_GameControlInput;
+extern char const* const _PREHASH_AxisData;
+extern char const* const _PREHASH_MetaData;
#endif
diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp
index 489b6ce6a6..9f9f4c852a 100644
--- a/indra/llmessage/patch_code.cpp
+++ b/indra/llmessage/patch_code.cpp
@@ -27,7 +27,6 @@
#include "linden_common.h"
#include "llmath.h"
-//#include "vmath.h"
#include "v3math.h"
#include "patch_dct.h"
#include "patch_code.h"
diff --git a/indra/llmessage/patch_dct.cpp b/indra/llmessage/patch_dct.cpp
index 728fe84537..e74e5fd459 100644
--- a/indra/llmessage/patch_dct.cpp
+++ b/indra/llmessage/patch_dct.cpp
@@ -27,7 +27,6 @@
#include "linden_common.h"
#include "llmath.h"
-//#include "vmath.h"
#include "v3math.h"
#include "patch_dct.h"
diff --git a/indra/llmessage/patch_idct.cpp b/indra/llmessage/patch_idct.cpp
index 5483cf98c0..4bcc439917 100644
--- a/indra/llmessage/patch_idct.cpp
+++ b/indra/llmessage/patch_idct.cpp
@@ -27,7 +27,6 @@
#include "linden_common.h"
#include "llmath.h"
-//#include "vmath.h"
#include "v3math.h"
#include "patch_dct.h"