summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-02-28 21:53:34 +0000
committerGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-02-28 21:53:34 +0000
commitaba5777d747d67db43e03772d30cb50d18d1a5d5 (patch)
tree10e4a3248143f709643bcc50490e982f93be30f7 /indra/llmessage
parent72270213f5eebd019b10bdd6ec15020ba3d2ecf5 (diff)
parente2e63598d40109d01e0311ce1444d3feedffcf66 (diff)
Merge
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llassetstorage.cpp34
-rw-r--r--indra/llmessage/llassetstorage.h31
-rw-r--r--indra/llmessage/llcorehttputil.cpp11
3 files changed, 55 insertions, 21 deletions
diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp
index 596d57c7b7..3d93f5aeb8 100644
--- a/indra/llmessage/llassetstorage.cpp
+++ b/indra/llmessage/llassetstorage.cpp
@@ -62,6 +62,24 @@ const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-0
const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds
+namespace
+{
+ template<typename T, typename... U>
+ bool operator == (const std::function<T(U...)> &a, const std::function <T(U...)> &b)
+ {
+ typedef T(fnType)(U...);
+
+ auto fnPtrA = a.target<T(*)(U...)>();
+ auto fnPtrB = b.target<T(*)(U...)>();
+ if (fnPtrA && fnPtrB)
+ return (*fnPtrA == *fnPtrB);
+ else if (!fnPtrA && !fnPtrB)
+ return true;
+ return false;
+ }
+
+}
+
///----------------------------------------------------------------------------
/// LLAssetInfo
///----------------------------------------------------------------------------
@@ -160,7 +178,7 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv )
LLBaseDownloadRequest::LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetType::EType type)
: mUUID(uuid),
mType(type),
- mDownCallback(NULL),
+ mDownCallback(),
mUserData(NULL),
mHost(),
mIsTemp(FALSE),
@@ -191,7 +209,7 @@ LLBaseDownloadRequest* LLBaseDownloadRequest::getCopy()
LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type)
: LLBaseDownloadRequest(uuid, type),
- mUpCallback( NULL ),
+ mUpCallback(),
mInfoCallback( NULL ),
mIsLocal(FALSE),
mIsUserWaiting(FALSE),
@@ -496,7 +514,11 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,
BOOL exists = mVFS->getExists(uuid, type);
LLVFile file(mVFS, uuid, type);
U32 size = exists ? file.getSize() : 0;
-
+
+// LAPRAS TESTING
+// if (type == LLAssetType::AT_SETTINGS)
+// size = 0;
+
if (size > 0)
{
// we've already got the file
@@ -1326,9 +1348,13 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,
iter != mPendingDownloads.end(); )
{
LLAssetRequest* tmp = *iter++;
+
+ //void(*const* cbptr)(LLVFS *, const LLUUID &, LLAssetType::EType, void *, S32, LLExtStat)
+ auto cbptr = tmp->mDownCallback.target<void(*)(LLVFS *, const LLUUID &, LLAssetType::EType, void *, S32, LLExtStat)>();
+
if (type == tmp->getType() &&
uuid == tmp->getUUID() &&
- legacyGetDataCallback == tmp->mDownCallback &&
+ (cbptr && (*cbptr == legacyGetDataCallback)) &&
callback == ((LLLegacyAssetRequest *)tmp->mUserData)->mDownCallback &&
user_data == ((LLLegacyAssetRequest *)tmp->mUserData)->mUserData)
{
diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h
index 33b88473b9..c799d8eefc 100644
--- a/indra/llmessage/llassetstorage.h
+++ b/indra/llmessage/llassetstorage.h
@@ -28,6 +28,7 @@
#ifndef LL_LLASSETSTORAGE_H
#define LL_LLASSETSTORAGE_H
#include <string>
+#include <functional>
#include "lluuid.h"
#include "lltimer.h"
@@ -59,6 +60,14 @@ const int LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4;
const int LL_ERR_INSUFFICIENT_PERMISSIONS = -5;
const int LL_ERR_PRICE_MISMATCH = -23018;
+// *TODO: these typedefs are passed into the VFS via a legacy C function pointer
+// future project would be to convert these to C++ callables (std::function<>) so that
+// we can use bind and remove the userData parameter.
+//
+typedef std::function<void(LLVFS *vfs, const LLUUID &asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status)> LLGetAssetCallback;
+typedef std::function<void(const LLUUID &asset_id, void *user_data, S32 status, LLExtStat ext_status)> LLStoreAssetCallback;
+
+
class LLAssetInfo
{
protected:
@@ -110,7 +119,8 @@ protected:
LLAssetType::EType mType;
public:
- void(*mDownCallback)(LLVFS*, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat);
+ LLGetAssetCallback mDownCallback;
+// void(*mDownCallback)(LLVFS*, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat);
void *mUserData;
LLHost mHost;
@@ -131,7 +141,8 @@ public:
virtual LLBaseDownloadRequest* getCopy();
- void (*mUpCallback)(const LLUUID&, void *, S32, LLExtStat);
+ LLStoreAssetCallback mUpCallback;
+// void (*mUpCallback)(const LLUUID&, void *, S32, LLExtStat);
void (*mInfoCallback)(LLAssetInfo *, void *, S32);
BOOL mIsLocal;
@@ -182,12 +193,7 @@ protected:
// Map of known bad assets
typedef std::map<LLUUID,U64,lluuid_less> toxic_asset_map_t;
-// *TODO: these typedefs are passed into the VFS via a legacy C function pointer
-// future project would be to convert these to C++ callables (std::function<>) so that
-// we can use bind and remove the userData parameter.
-//
-typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id,
- LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status);
+
class LLAssetStorage
{
@@ -195,7 +201,8 @@ public:
// VFS member is public because static child methods need it :(
LLVFS *mVFS;
LLVFS *mStaticVFS;
- typedef void (*LLStoreAssetCallback)(const LLUUID &asset_id, void *user_data, S32 status, LLExtStat ext_status);
+ typedef ::LLStoreAssetCallback LLStoreAssetCallback;
+ typedef ::LLGetAssetCallback LLGetAssetCallback;
enum ERequestType
{
@@ -377,8 +384,8 @@ protected:
void _cleanupRequests(BOOL all, S32 error);
void _callUploadCallbacks(const LLUUID &uuid, const LLAssetType::EType asset_type, BOOL success, LLExtStat ext_status);
- virtual void _queueDataRequest(const LLUUID& uuid, LLAssetType::EType type,
- void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat),
+ virtual void _queueDataRequest(const LLUUID& uuid, LLAssetType::EType type, LLGetAssetCallback callback,
+// void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat),
void *user_data, BOOL duplicate,
BOOL is_priority) = 0;
@@ -424,7 +431,7 @@ class LLLegacyAssetRequest
{
public:
void (*mDownCallback)(const char *, const LLUUID&, void *, S32, LLExtStat);
- LLAssetStorage::LLStoreAssetCallback mUpCallback;
+ LLStoreAssetCallback mUpCallback;
void *mUserData;
};
diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp
index ac4b1310a4..24387fbffd 100644
--- a/indra/llmessage/llcorehttputil.cpp
+++ b/indra/llmessage/llcorehttputil.cpp
@@ -84,7 +84,7 @@ void logMessageSuccess(std::string logAuth, std::string url, std::string message
void logMessageFail(std::string logAuth, std::string url, std::string message)
{
- LL_WARNS("CoreHTTP") << logAuth << " Failure '" << message << "' for " << url << LL_ENDL;
+ LL_INFOS("CoreHTTP") << logAuth << " Possible failure '" << message << "' for " << url << LL_ENDL;
}
//=========================================================================
@@ -279,10 +279,11 @@ void HttpCoroHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespons
result = LLSD::emptyMap();
LLCore::HttpStatus::type_enum_t errType = status.getType();
- LL_WARNS("CoreHTTP")
- << " Error[" << status.toTerseString() << "] cannot "<< response->getRequestMethod()
- << " to url '" << response->getRequestURL()
- << "' because " << status.toString() << LL_ENDL;
+ LL_INFOS()
+ << "Possible failure [" << status.toTerseString() << "] cannot "<< response->getRequestMethod()
+ << " url '" << response->getRequestURL()
+ << "' because " << status.toString()
+ << LL_ENDL;
if ((errType >= 400) && (errType < 500))
{
LLSD body = this->parseBody(response, parseSuccess);