diff options
Diffstat (limited to 'indra/llmessage')
31 files changed, 369 insertions, 261 deletions
| diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index 2f99ca069e..f0a1dfe940 100644 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -9,7 +9,7 @@ include(LLCommon)  include(LLCoreHttp)  include(LLMath)  include(LLMessage) -include(LLVFS) +include(LLFileSystem)  include(LLAddBuildTest)  include(Python)  include(Tut) @@ -23,7 +23,7 @@ include_directories(      ${LLCOREHTTP_INCLUDE_DIRS}      ${LLMATH_INCLUDE_DIRS}      ${LLMESSAGE_INCLUDE_DIRS} -    ${LLVFS_INCLUDE_DIRS} +    ${LLFILESYSTEM_INCLUDE_DIRS}      ${JSONCPP_INCLUDE_DIR}      ) @@ -209,7 +209,7 @@ target_link_libraries(    llmessage    ${CURL_LIBRARIES}    ${LLCOMMON_LIBRARIES} -  ${LLVFS_LIBRARIES} +  ${LLFILESYSTEM_LIBRARIES}    ${LLMATH_LIBRARIES}    ${JSONCPP_LIBRARIES}    ${OPENSSL_LIBRARIES} @@ -227,7 +227,7 @@ target_link_libraries(    llmessage    ${CURL_LIBRARIES}    ${LLCOMMON_LIBRARIES} -  ${LLVFS_LIBRARIES} +  ${LLFILESYSTEM_LIBRARIES}    ${LLMATH_LIBRARIES}    ${JSONCPP_LIBRARIES}    ${OPENSSL_LIBRARIES} @@ -257,7 +257,7 @@ if (LL_TESTS)  if (LINUX)    set(test_libs      ${WINDOWS_LIBRARIES} -    ${LLVFS_LIBRARIES} +    ${LLFILESYSTEM_LIBRARIES}      ${LLMATH_LIBRARIES}      ${CURL_LIBRARIES}      ${NGHTTP2_LIBRARIES} @@ -273,7 +273,7 @@ if (LINUX)  else (LINUX)    set(test_libs      ${WINDOWS_LIBRARIES} -    ${LLVFS_LIBRARIES} +    ${LLFILESYSTEM_LIBRARIES}      ${LLMATH_LIBRARIES}      ${CURL_LIBRARIES}      ${NGHTTP2_LIBRARIES} diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index d7801b6ddc..f38a5e663e 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -42,8 +42,7 @@  // this library includes  #include "message.h"  #include "llxfermanager.h" -#include "llvfile.h" -#include "llvfs.h" +#include "llfilesystem.h"  #include "lldbstrings.h"  #include "lltransfersourceasset.h" @@ -202,7 +201,7 @@ LLBaseDownloadRequest::LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetTy        mIsTemp(FALSE),        mIsPriority(FALSE),        mDataSentInFirstPacket(FALSE), -      mDataIsInVFS(FALSE) +      mDataIsInCache(FALSE)  {      // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been      //  running a message system loop. @@ -266,7 +265,8 @@ LLSD LLAssetRequest::getFullDetails() const      sd["is_local"] = mIsLocal;      sd["is_priority"] = mIsPriority;      sd["data_send_in_first_packet"] = mDataSentInFirstPacket; -    sd["data_is_in_vfs"] = mDataIsInVFS; +    // Note: cannot change this (easily) since it is consumed by server +    sd["data_is_in_vfs"] = mDataIsInCache;      return sd;  } @@ -330,28 +330,23 @@ LLBaseDownloadRequest* LLEstateAssetRequest::getCopy()  // TODO: rework tempfile handling? -LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, LLVFS *static_vfs, const LLHost &upstream_host) +LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, const LLHost &upstream_host)  { -    _init(msg, xfer, vfs, static_vfs, upstream_host); +    _init(msg, xfer, upstream_host);  } -LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, -                               LLVFS *vfs, LLVFS *static_vfs) +LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer)  { -    _init(msg, xfer, vfs, static_vfs, LLHost()); +    _init(msg, xfer, LLHost());  }  void LLAssetStorage::_init(LLMessageSystem *msg,                             LLXferManager *xfer, -                           LLVFS *vfs, -                           LLVFS *static_vfs,                             const LLHost &upstream_host)  {      mShutDown = FALSE;      mMessageSys = msg;      mXferManager = xfer; -    mVFS = vfs; -    mStaticVFS = static_vfs;      setUpstream(upstream_host);      msg->setHandlerFuncFast(_PREHASH_AssetUploadComplete, processUploadComplete, (void **)this); @@ -430,7 +425,7 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)          }          if (tmp->mDownCallback)          { -            tmp->mDownCallback(mVFS, tmp->getUUID(), tmp->getType(), tmp->mUserData, error, LLExtStat::NONE); +            tmp->mDownCallback(tmp->getUUID(), tmp->getType(), tmp->mUserData, error, LLExtStat::NONE);          }          if (tmp->mInfoCallback)          { @@ -443,10 +438,10 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)  BOOL LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType type)  { -    return mStaticVFS->getExists(uuid, type) || mVFS->getExists(uuid, type); +    return LLFileSystem::getExists(uuid, type);  } -bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type, +bool LLAssetStorage::findInCacheAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type,                                                        LLGetAssetCallback callback, void *user_data)  {      if (user_data) @@ -455,17 +450,17 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse          llassert(callback != NULL);      } -    BOOL exists = mStaticVFS->getExists(uuid, type); +    BOOL exists = LLFileSystem::getExists(uuid, type);      if (exists)      { -        LLVFile file(mStaticVFS, uuid, type); +        LLFileSystem file(uuid, type);          U32 size = file.getSize();          if (size > 0)          {              // we've already got the file              if (callback)              { -                callback(mStaticVFS, uuid, type, user_data, LL_ERR_NOERR, LLExtStat::VFS_CACHED); +                callback(uuid, type, user_data, LL_ERR_NOERR, LLExtStat::CACHE_CACHED);              }              return true;          } @@ -506,7 +501,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,          if (callback)          {              add(sFailedDownloadCount, 1); -            callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_FAILED, LLExtStat::NONE); +            callback(uuid, type, user_data, LL_ERR_ASSET_REQUEST_FAILED, LLExtStat::NONE);          }          return;      } @@ -517,20 +512,19 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,          if (callback)          {              add(sFailedDownloadCount, 1); -            callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LLExtStat::NULL_UUID); +            callback(uuid, type, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LLExtStat::NULL_UUID);          }          return;      } -    // Try static VFS first. -    if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data)) +    if (findInCacheAndInvokeCallback(uuid,type,callback,user_data))      { -        LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in static VFS" << LL_ENDL; +        LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in cache" << LL_ENDL;          return;      } -    BOOL exists = mVFS->getExists(uuid, type); -    LLVFile file(mVFS, uuid, type); +    BOOL exists = LLFileSystem::getExists(uuid, type); +    LLFileSystem file(uuid, type);      U32 size = exists ? file.getSize() : 0;      if (size > 0) @@ -540,10 +534,10 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,          // unless there's a weird error          if (callback)          { -            callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LLExtStat::VFS_CACHED); +            callback(uuid, type, user_data, LL_ERR_NOERR, LLExtStat::CACHE_CACHED);          } -        LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in VFS" << LL_ENDL; +        LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in cache" << LL_ENDL;      }      else      { @@ -616,7 +610,7 @@ void LLAssetStorage::removeAndCallbackPendingDownloads(const LLUUID& file_id, LL              {                  add(sFailedDownloadCount, 1);              } -            tmp->mDownCallback(gAssetStorage->mVFS, callback_id, callback_type, tmp->mUserData, result_code, ext_status); +            tmp->mDownCallback(callback_id, callback_type, tmp->mUserData, result_code, ext_status);          }          delete tmp;      } @@ -670,7 +664,7 @@ void LLAssetStorage::downloadCompleteCallback(      if (LL_ERR_NOERR == result)      {          // we might have gotten a zero-size file -        LLVFile vfile(gAssetStorage->mVFS, callback_id, callback_type); +        LLFileSystem vfile(callback_id, callback_type);          if (vfile.getSize() <= 0)          {              LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset " << callback_id << LL_ENDL; @@ -719,19 +713,19 @@ void LLAssetStorage::getEstateAsset(          if (callback)          {              add(sFailedDownloadCount, 1); -            callback(mVFS, asset_id, atype, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LLExtStat::NULL_UUID); +            callback(asset_id, atype, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LLExtStat::NULL_UUID);          }          return;      } -    // Try static VFS first. -    if (findInStaticVFSAndInvokeCallback(asset_id,atype,callback,user_data)) +    // Try static first. +    if (findInCacheAndInvokeCallback(asset_id,atype,callback,user_data))      {          return;      } -    BOOL exists = mVFS->getExists(asset_id, atype); -    LLVFile file(mVFS, asset_id, atype); +    BOOL exists = LLFileSystem::getExists(asset_id, atype); +    LLFileSystem file(asset_id, atype);      U32 size = exists ? file.getSize() : 0;      if (size > 0) @@ -741,7 +735,7 @@ void LLAssetStorage::getEstateAsset(          // unless there's a weird error          if (callback)          { -            callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LLExtStat::VFS_CACHED); +            callback(asset_id, atype, user_data, LL_ERR_NOERR, LLExtStat::CACHE_CACHED);          }      }      else @@ -792,7 +786,7 @@ void LLAssetStorage::getEstateAsset(              if (callback)              {                  add(sFailedDownloadCount, 1); -                callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LLExtStat::NO_UPSTREAM); +                callback(asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LLExtStat::NO_UPSTREAM);              }          }      } @@ -824,7 +818,7 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(      if (LL_ERR_NOERR == result)      {          // we might have gotten a zero-size file -        LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getAType()); +        LLFileSystem vfile(req->getUUID(), req->getAType());          if (vfile.getSize() <= 0)          {              LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL; @@ -838,7 +832,7 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(      {          add(sFailedDownloadCount, 1);      } -    req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getAType(), req->mUserData, result, ext_status); +    req->mDownCallback(req->getUUID(), req->getAType(), req->mUserData, result, ext_status);  }  void LLAssetStorage::getInvItemAsset( @@ -861,14 +855,13 @@ void LLAssetStorage::getInvItemAsset(      if(asset_id.notNull())      { -        // Try static VFS first. -        if (findInStaticVFSAndInvokeCallback( asset_id, atype, callback, user_data)) +        if (findInCacheAndInvokeCallback( asset_id, atype, callback, user_data))          {              return;          } -        exists = mVFS->getExists(asset_id, atype); -        LLVFile file(mVFS, asset_id, atype); +        exists = LLFileSystem::getExists(asset_id, atype); +        LLFileSystem file(asset_id, atype);          size = exists ? file.getSize() : 0;          if(exists && size < 1)          { @@ -885,7 +878,7 @@ void LLAssetStorage::getInvItemAsset(          // unless there's a weird error          if (callback)          { -            callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LLExtStat::VFS_CACHED); +            callback(asset_id, atype, user_data, LL_ERR_NOERR, LLExtStat::CACHE_CACHED);          }      }      else @@ -936,7 +929,7 @@ void LLAssetStorage::getInvItemAsset(              if (callback)              {                  add(sFailedDownloadCount, 1); -                callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LLExtStat::NO_UPSTREAM); +                callback(asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LLExtStat::NO_UPSTREAM);              }          }      } @@ -968,7 +961,7 @@ void LLAssetStorage::downloadInvItemCompleteCallback(      if (LL_ERR_NOERR == result)      {          // we might have gotten a zero-size file -        LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType()); +        LLFileSystem vfile(req->getUUID(), req->getType());          if (vfile.getSize() <= 0)          {              LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL; @@ -982,7 +975,7 @@ void LLAssetStorage::downloadInvItemCompleteCallback(      {          add(sFailedDownloadCount, 1);      } -    req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), req->mUserData, result, ext_status); +    req->mDownCallback(req->getUUID(), req->getType(), req->mUserData, result, ext_status);  }  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1293,7 +1286,7 @@ bool LLAssetStorage::deletePendingRequestImpl(LLAssetStorage::request_list_t* re          if (req->mDownCallback)          {              add(sFailedDownloadCount, 1); -            req->mDownCallback(mVFS, req->getUUID(), req->getType(), req->mUserData, error, LLExtStat::REQUEST_DROPPED); +            req->mDownCallback(req->getUUID(), req->getType(), req->mUserData, error, LLExtStat::REQUEST_DROPPED);          }          if (req->mInfoCallback)          { @@ -1363,8 +1356,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,      {          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)>(); +        auto cbptr = tmp->mDownCallback.target<void(*)(const LLUUID &, LLAssetType::EType, void *, S32, LLExtStat)>();          if (type == tmp->getType() &&               uuid == tmp->getUUID() && @@ -1389,8 +1381,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,  }  // static -void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, -                                           const LLUUID &uuid,  +void LLAssetStorage::legacyGetDataCallback(const LLUUID &uuid,                                              LLAssetType::EType type,                                             void *user_data,                                              S32 status,  @@ -1405,7 +1396,7 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs,      if ( !status           && !toxic )      { -        LLVFile file(vfs, uuid, type); +        LLFileSystem file(uuid, type);          std::string uuid_str; diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index 7e4572f50f..274e6a50ad 100644 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -44,7 +44,6 @@  class LLMessageSystem;  class LLXferManager;  class LLAssetStorage; -class LLVFS;  class LLSD;  // anything that takes longer than this to download will abort. @@ -60,11 +59,11 @@ 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 +// *TODO: these typedefs are passed into the cache 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, 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; @@ -120,7 +119,6 @@ protected:  public:      LLGetAssetCallback mDownCallback; -//    void(*mDownCallback)(LLVFS*, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat);      void	*mUserData;      LLHost  mHost; @@ -128,7 +126,7 @@ public:      F64Seconds		mTime;				// Message system time      BOOL    mIsPriority;      BOOL	mDataSentInFirstPacket; -    BOOL	mDataIsInVFS; +    BOOL	mDataIsInCache;  };  class LLAssetRequest : public LLBaseDownloadRequest @@ -198,9 +196,6 @@ typedef std::map<LLUUID,U64,lluuid_less> toxic_asset_map_t;  class LLAssetStorage  {  public: -	// VFS member is public because static child methods need it :( -	LLVFS *mVFS; -	LLVFS *mStaticVFS;      typedef ::LLStoreAssetCallback LLStoreAssetCallback;      typedef ::LLGetAssetCallback LLGetAssetCallback; @@ -230,11 +225,9 @@ protected:  	toxic_asset_map_t	mToxicAssetMap;		// Objects in this list are known to cause problems and are not loaded  public: -	LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, -				   LLVFS *vfs, LLVFS *static_vfs, const LLHost &upstream_host); +	LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, const LLHost &upstream_host); -	LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, -				   LLVFS *vfs, LLVFS *static_vfs); +	LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer);  	virtual ~LLAssetStorage();  	void setUpstream(const LLHost &upstream_host); @@ -284,7 +277,7 @@ public:  	void		markAssetToxic( const LLUUID& uuid );  protected: -	bool findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type, +	bool findInCacheAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type,  										  LLGetAssetCallback callback, void *user_data);  	LLSD getPendingDetailsImpl(const request_list_t* requests, @@ -375,7 +368,7 @@ public:  		bool user_waiting = false,  		F64Seconds timeout  = LL_ASSET_STORAGE_TIMEOUT) = 0; -	static void legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType, void *user_data, S32 status, LLExtStat ext_status); +	static void legacyGetDataCallback(const LLUUID &uuid, LLAssetType::EType, void *user_data, S32 status, LLExtStat ext_status);  	static void legacyStoreDataCallback(const LLUUID &uuid, void *user_data, S32 status, LLExtStat ext_status);  	// add extra methods to handle metadata @@ -385,15 +378,12 @@ protected:  	void _callUploadCallbacks(const LLUUID &uuid, const LLAssetType::EType asset_type, BOOL success, LLExtStat ext_status);  	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;  private:  	void _init(LLMessageSystem *msg,  			   LLXferManager *xfer, -			   LLVFS *vfs, -			   LLVFS *static_vfs,  			   const LLHost &upstream_host);  protected: @@ -408,7 +398,7 @@ protected:  		MR_FILE_NONEXIST	= 3,	// Old format store call - source file does not exist  		MR_NO_FILENAME		= 4,	// Old format store call - source filename is NULL/0-length  		MR_NO_UPSTREAM		= 5,	// Upstream provider is missing -		MR_VFS_CORRUPTION	= 6		// VFS is corrupt - too-large or mismatched stated/returned sizes +		MR_CACHE_CORRUPTION	= 6		// cache is corrupt - too-large or mismatched stated/returned sizes  	};  	static class LLMetrics *metric_recipient; diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index c67f59bc0c..846549b368 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -196,6 +196,10 @@ void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vector<LLU              LLAvatarNameCache::getInstance()->handleAvNameCacheSuccess(results, httpResults);          }      } +    catch (const LLCoros::Stop&) +    { +        LL_DEBUGS("AvNameCache") << "Received a shutdown exception" << LL_ENDL; +    }      catch (...)      {          LOG_UNHANDLED_EXCEPTION(STRINGIZE("coroutine " << LLCoros::getName() diff --git a/indra/llmessage/llcoproceduremanager.h b/indra/llmessage/llcoproceduremanager.h index 2d460826ff..c5bc37dd0e 100644 --- a/indra/llmessage/llcoproceduremanager.h +++ b/indra/llmessage/llcoproceduremanager.h @@ -32,7 +32,6 @@  #include "llcoros.h"  #include "llcorehttputil.h"  #include "lluuid.h" -#include <boost/smart_ptr/shared_ptr.hpp>  class LLCoprocedurePool; @@ -84,7 +83,7 @@ public:  private: -    typedef boost::shared_ptr<LLCoprocedurePool> poolPtr_t; +    typedef std::shared_ptr<LLCoprocedurePool> poolPtr_t;      typedef std::map<std::string, poolPtr_t> poolMap_t;      poolMap_t mPoolMap; diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index 0eae6d9826..7031f1aa8c 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -37,7 +37,7 @@  #include "llsdserialize.h"  #include "reader.h" // JSON  #include "writer.h" // JSON -#include "llvfile.h" +#include "llfilesystem.h"  #include "message.h" // for getting the port @@ -784,7 +784,7 @@ LLSD HttpCoroutineAdapter::postFileAndSuspend(LLCore::HttpRequest::ptr_t request      // scoping for our streams so that they go away when we no longer need them.      {          LLCore::BufferArrayStream outs(fileData.get()); -        LLVFile vfile(gVFS, assetId, assetType, LLVFile::READ); +        LLFileSystem vfile(assetId, assetType, LLFileSystem::READ);          S32 fileSize = vfile.getSize();          U8* fileBuffer; diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index 6cf6af6437..b6adc102d2 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -127,13 +127,7 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name,  		total_bits++;  	} -	S32 min_val;  	U32 max_val; -	if (is_signed) -	{ -		min_val = 1 << int_bits; -		min_val *= -1; -	}  	max_val = 1 << int_bits;  	F32 fixed_val; @@ -173,6 +167,71 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name,  	return ok;  } +BOOL LLDataPacker::unpackU16s(U16 *values, S32 count, const char *name) +{ +    for (S32 idx = 0; idx < count; ++idx) +    { +        if (!unpackU16(values[idx], name)) +        { +            LL_WARNS("DATAPACKER") << "Buffer overflow reading Unsigned 16s \"" << name << "\" at index " << idx << "!" << LL_ENDL; +            return FALSE; +        } +    } +    return TRUE; +} + +BOOL LLDataPacker::unpackS16s(S16 *values, S32 count, const char *name) +{ +    for (S32 idx = 0; idx < count; ++idx) +    { +        if (!unpackS16(values[idx], name)) +        { +            LL_WARNS("DATAPACKER") << "Buffer overflow reading Signed 16s \"" << name << "\" at index " << idx << "!" << LL_ENDL; +            return FALSE; +        } +    } +    return TRUE; +} + +BOOL LLDataPacker::unpackF32s(F32 *values, S32 count, const char *name) +{ +    for (S32 idx = 0; idx < count; ++idx) +    { +        if (!unpackF32(values[idx], name)) +        { +            LL_WARNS("DATAPACKER") << "Buffer overflow reading Float 32s \"" << name << "\" at index " << idx << "!" << LL_ENDL; +            return FALSE; +        } +    } +    return TRUE; +} + +BOOL LLDataPacker::unpackColor4Us(LLColor4U *values, S32 count, const char *name) +{ +    for (S32 idx = 0; idx < count; ++idx) +    { +        if (!unpackColor4U(values[idx], name)) +        { +            LL_WARNS("DATAPACKER") << "Buffer overflow reading Float 32s \"" << name << "\" at index " << idx << "!" << LL_ENDL; +            return FALSE; +        } +    } +    return TRUE; +} + +BOOL LLDataPacker::unpackUUIDs(LLUUID *values, S32 count, const char *name) +{ +    for (S32 idx = 0; idx < count; ++idx) +    { +        if (!unpackUUID(values[idx], name)) +        { +            LL_WARNS("DATAPACKER") << "Buffer overflow reading UUIDs \"" << name << "\" at index " << idx << "!" << LL_ENDL; +            return FALSE; +        } +    } +    return TRUE; +} +  //---------------------------------------------------------------------------  // LLDataPackerBinaryBuffer implementation  //--------------------------------------------------------------------------- @@ -319,6 +378,29 @@ BOOL LLDataPackerBinaryBuffer::unpackU16(U16 &value, const char *name)  	return success;  } +BOOL LLDataPackerBinaryBuffer::packS16(const S16 value, const char *name) +{ +    BOOL success = verifyLength(sizeof(S16), name); + +    if (mWriteEnabled && success) +    { +        htolememcpy(mCurBufferp, &value, MVT_S16, 2); +    } +    mCurBufferp += 2; +    return success; +} + +BOOL LLDataPackerBinaryBuffer::unpackS16(S16 &value, const char *name) +{ +    BOOL success = verifyLength(sizeof(S16), name); + +    if (success) +    { +        htolememcpy(&value, mCurBufferp, MVT_S16, 2); +    } +    mCurBufferp += 2; +    return success; +}  BOOL LLDataPackerBinaryBuffer::packU32(const U32 value, const char *name)  { @@ -884,6 +966,52 @@ BOOL LLDataPackerAsciiBuffer::unpackU16(U16 &value, const char *name)  	return success;  } +BOOL LLDataPackerAsciiBuffer::packS16(const S16 value, const char *name) +{ +    BOOL success = TRUE; +    writeIndentedName(name); +    int numCopied = 0; +    if (mWriteEnabled) +    { +        numCopied = snprintf(mCurBufferp, getBufferSize() - getCurrentSize(), "%d\n", value); /* Flawfinder: ignore */ +    } +    else +    { +        numCopied = snprintf(DUMMY_BUFFER, sizeof(DUMMY_BUFFER), "%d\n", value); /* Flawfinder: ignore */ +    } + +    // snprintf returns number of bytes that would have been written +    // had the output not being truncated. In that case, it will +    // return either -1 or value >= passed in size value . So a check needs to be added +    // to detect truncation, and if there is any, only account for the +    // actual number of bytes written..and not what could have been +    // written. +    if(numCopied < 0 || numCopied > getBufferSize() - getCurrentSize()) +    { +        numCopied = getBufferSize() - getCurrentSize(); +        LL_WARNS() << "LLDataPackerAsciiBuffer::packS16: val truncated: " << LL_ENDL; +    } + +    mCurBufferp += numCopied; + +    return success; +} + + +BOOL LLDataPackerAsciiBuffer::unpackS16(S16 &value, const char *name) +{ +    BOOL success = TRUE; +    char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ +    if (!getValueStr(name, valuestr, DP_BUFSIZE)) +    { +        return FALSE; +    } + +    S32 in_val; +    sscanf(valuestr, "%d", &in_val); +    value = in_val; +    return success; +}  BOOL LLDataPackerAsciiBuffer::packU32(const U32 value, const char *name)  { @@ -1587,6 +1715,36 @@ BOOL LLDataPackerAsciiFile::unpackU16(U16 &value, const char *name)  	return success;  } +BOOL LLDataPackerAsciiFile::packS16(const S16 value, const char *name) +{ +    BOOL success = TRUE; +    writeIndentedName(name); +    if (mFP) +    { +        fprintf(mFP, "%d\n", value);	 +    } +    else if (mOutputStream) +    { +        *mOutputStream << "" << value << "\n"; +    } +    return success; +} + + +BOOL LLDataPackerAsciiFile::unpackS16(S16 &value, const char *name) +{ +    BOOL success = TRUE; +    char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ +    if (!getValueStr(name, valuestr, DP_BUFSIZE)) +    { +        return FALSE; +    } + +    S32 in_val; +    sscanf(valuestr, "%d", &in_val); +    value = in_val; +    return success; +}  BOOL LLDataPackerAsciiFile::packU32(const U32 value, const char *name)  { diff --git a/indra/llmessage/lldatapacker.h b/indra/llmessage/lldatapacker.h index 5140f56c01..ac28cadbce 100644 --- a/indra/llmessage/lldatapacker.h +++ b/indra/llmessage/lldatapacker.h @@ -60,6 +60,11 @@ public:  	virtual BOOL		packU16(const U16 value, const char *name) = 0;  	virtual BOOL		unpackU16(U16 &value, const char *name) = 0; +    BOOL                unpackU16s(U16 *value, S32 count, const char *name); +  +    virtual BOOL		packS16(const S16 value, const char *name) = 0; +    virtual BOOL		unpackS16(S16 &value, const char *name) = 0; +    BOOL                unpackS16s(S16 *value, S32 count, const char *name);  	virtual BOOL		packU32(const U32 value, const char *name) = 0;  	virtual BOOL		unpackU32(U32 &value, const char *name) = 0; @@ -69,6 +74,7 @@ public:  	virtual BOOL		packF32(const F32 value, const char *name) = 0;  	virtual BOOL		unpackF32(F32 &value, const char *name) = 0; +    BOOL                unpackF32s(F32 *values, S32 count, const char *name);  	// Packs a float into an integer, using the given size  	// and picks the right U* data type to pack into. @@ -82,6 +88,7 @@ public:  	virtual BOOL		packColor4U(const LLColor4U &value, const char *name) = 0;  	virtual BOOL		unpackColor4U(LLColor4U &value, const char *name) = 0; +    BOOL                unpackColor4Us(LLColor4U *values, S32 count, const char *name);  	virtual BOOL		packVector2(const LLVector2 &value, const char *name) = 0;  	virtual BOOL		unpackVector2(LLVector2 &value, const char *name) = 0; @@ -94,6 +101,7 @@ public:  	virtual BOOL		packUUID(const LLUUID &value, const char *name) = 0;  	virtual BOOL		unpackUUID(LLUUID &value, const char *name) = 0; +    BOOL                unpackUUIDs(LLUUID *values, S32 count, const char *name);  			U32			getPassFlags() const	{ return mPassFlags; }  			void		setPassFlags(U32 flags)	{ mPassFlags = flags; }  protected: @@ -139,6 +147,9 @@ public:  	/*virtual*/ BOOL		packU16(const U16 value, const char *name);  	/*virtual*/ BOOL		unpackU16(U16 &value, const char *name); +    /*virtual*/ BOOL		packS16(const S16 value, const char *name); +    /*virtual*/ BOOL		unpackS16(S16 &value, const char *name); +  	/*virtual*/ BOOL		packU32(const U32 value, const char *name);  	/*virtual*/ BOOL		unpackU32(U32 &value, const char *name); @@ -247,6 +258,9 @@ public:  	/*virtual*/ BOOL		packU16(const U16 value, const char *name);  	/*virtual*/ BOOL		unpackU16(U16 &value, const char *name); +    /*virtual*/ BOOL		packS16(const S16 value, const char *name); +    /*virtual*/ BOOL		unpackS16(S16 &value, const char *name); +  	/*virtual*/ BOOL		packU32(const U32 value, const char *name);  	/*virtual*/ BOOL		unpackU32(U32 &value, const char *name); @@ -375,6 +389,9 @@ public:  	/*virtual*/ BOOL		packU16(const U16 value, const char *name);  	/*virtual*/ BOOL		unpackU16(U16 &value, const char *name); +    /*virtual*/ BOOL		packS16(const S16 value, const char *name); +    /*virtual*/ BOOL		unpackS16(S16 &value, const char *name); +  	/*virtual*/ BOOL		packU32(const U32 value, const char *name);  	/*virtual*/ BOOL		unpackU32(U32 &value, const char *name); diff --git a/indra/llmessage/llextendedstatus.h b/indra/llmessage/llextendedstatus.h index 9923d73c1a..2a53dced80 100644 --- a/indra/llmessage/llextendedstatus.h +++ b/indra/llmessage/llextendedstatus.h @@ -1,7 +1,7 @@  /**    * @file llextendedstatus.h   * @date   August 2007 - * @brief extended status codes for curl/vfs/resident asset storage and delivery + * @brief extended status codes for curl/resident asset storage and delivery   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * Second Life Viewer Source Code @@ -32,9 +32,9 @@ enum class LLExtStat: uint32_t  {  	// Status provider groups - Top bits indicate which status type it is  	// Zero is common status code (next section) -	CURL_RESULT	= 1UL<<30, // serviced by curl - use 1L if we really implement the below -	RES_RESULT	= 2UL<<30, // serviced by resident copy -	VFS_RESULT	= 3UL<<30, // serviced by vfs +	CURL_RESULT	 = 1UL<<30, // serviced by curl - use 1L if we really implement the below +	RES_RESULT	 = 2UL<<30, // serviced by resident copy +	CACHE_RESULT = 3UL<<30, // serviced by cache  	// Common Status Codes @@ -54,9 +54,9 @@ enum class LLExtStat: uint32_t  	// Memory-Resident status codes:  	// None at present -	// VFS status codes: -	VFS_CACHED	= VFS_RESULT | 0x0001, -	VFS_CORRUPT	= VFS_RESULT | 0x0002, +	// CACHE status codes: +	CACHE_CACHED	= CACHE_RESULT | 0x0001, +	CACHE_CORRUPT	= CACHE_RESULT | 0x0002,  }; diff --git a/indra/llmessage/llfiltersd2xmlrpc.cpp b/indra/llmessage/llfiltersd2xmlrpc.cpp index d3e195789b..0abdafbdfc 100644 --- a/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -309,7 +309,6 @@ LLFilterSD2XMLRPCResponse::~LLFilterSD2XMLRPCResponse()  } -static LLTrace::BlockTimerStatHandle FTM_PROCESS_SD2XMLRPC_RESPONSE("SD2XMLRPC Response");  // virtual  LLIOPipe::EStatus LLFilterSD2XMLRPCResponse::process_impl(  	const LLChannelDescriptors& channels, @@ -318,7 +317,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCResponse::process_impl(  	LLSD& context,  	LLPumpIO* pump)  { -	LL_RECORD_BLOCK_TIME(FTM_PROCESS_SD2XMLRPC_RESPONSE); +    LL_PROFILE_ZONE_SCOPED;  	PUMP_DEBUG;  	// This pipe does not work if it does not have everyting. This @@ -386,8 +385,6 @@ LLFilterSD2XMLRPCRequest::~LLFilterSD2XMLRPCRequest()  {  } -static LLTrace::BlockTimerStatHandle FTM_PROCESS_SD2XMLRPC_REQUEST("S22XMLRPC Request"); -  // virtual  LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl(  	const LLChannelDescriptors& channels, @@ -396,7 +393,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl(  	LLSD& context,  	LLPumpIO* pump)  { -	LL_RECORD_BLOCK_TIME(FTM_PROCESS_SD2XMLRPC_REQUEST); +    LL_PROFILE_ZONE_SCOPED;  	// This pipe does not work if it does not have everyting. This  	// could be addressed by making a stream parser for llsd which  	// handled partial information. @@ -593,8 +590,6 @@ LLFilterXMLRPCResponse2LLSD::~LLFilterXMLRPCResponse2LLSD()  {  } -static LLTrace::BlockTimerStatHandle FTM_PROCESS_XMLRPC2LLSD_RESPONSE("XMLRPC2LLSD Response"); -  LLIOPipe::EStatus LLFilterXMLRPCResponse2LLSD::process_impl(  	const LLChannelDescriptors& channels,  	buffer_ptr_t& buffer, @@ -602,7 +597,7 @@ LLIOPipe::EStatus LLFilterXMLRPCResponse2LLSD::process_impl(  	LLSD& context,  	LLPumpIO* pump)  { -	LL_RECORD_BLOCK_TIME(FTM_PROCESS_XMLRPC2LLSD_RESPONSE); +    LL_PROFILE_ZONE_SCOPED;  	PUMP_DEBUG;  	if(!eos) return STATUS_BREAK; @@ -679,7 +674,6 @@ LLFilterXMLRPCRequest2LLSD::~LLFilterXMLRPCRequest2LLSD()  {  } -static LLTrace::BlockTimerStatHandle FTM_PROCESS_XMLRPC2LLSD_REQUEST("XMLRPC2LLSD Request");  LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl(  	const LLChannelDescriptors& channels,  	buffer_ptr_t& buffer, @@ -687,7 +681,7 @@ LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl(  	LLSD& context,  	LLPumpIO* pump)  { -	LL_RECORD_BLOCK_TIME(FTM_PROCESS_XMLRPC2LLSD_REQUEST); +    LL_PROFILE_ZONE_SCOPED;  	PUMP_DEBUG;  	if(!eos) return STATUS_BREAK;  	if(!buffer) return STATUS_ERROR; diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp index 6fd17c9154..6e9598a0a3 100644 --- a/indra/llmessage/llhttpnode.cpp +++ b/indra/llmessage/llhttpnode.cpp @@ -121,6 +121,7 @@ LLSD LLHTTPNode::simplePost(const LLSD& input) const  // virtual  void LLHTTPNode::get(LLHTTPNode::ResponsePtr response, const LLSD& context) const  { +    LL_PROFILE_ZONE_SCOPED;  	try  	{  		response->result(simpleGet()); @@ -134,6 +135,7 @@ void LLHTTPNode::get(LLHTTPNode::ResponsePtr response, const LLSD& context) cons  // virtual  void LLHTTPNode::put(LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const  { +    LL_PROFILE_ZONE_SCOPED;  	try  	{  		response->result(simplePut(input)); @@ -147,6 +149,7 @@ void LLHTTPNode::put(LLHTTPNode::ResponsePtr response, const LLSD& context, cons  // virtual  void LLHTTPNode::post(LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const  { +    LL_PROFILE_ZONE_SCOPED;  	try  	{  		response->result(simplePost(input)); @@ -160,6 +163,7 @@ void LLHTTPNode::post(LLHTTPNode::ResponsePtr response, const LLSD& context, con  // virtual  void LLHTTPNode::del(LLHTTPNode::ResponsePtr response, const LLSD& context) const  { +    LL_PROFILE_ZONE_SCOPED;      try      {  	response->result(simpleDel(context)); diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index d9042fa8b0..c707c7ad09 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -132,12 +132,6 @@ private:  	LLSD mHeaders;  }; -static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_PIPE("HTTP Pipe"); -static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_GET("HTTP Get"); -static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_PUT("HTTP Put"); -static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_POST("HTTP Post"); -static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_DELETE("HTTP Delete"); -  LLIOPipe::EStatus LLHTTPPipe::process_impl(  	const LLChannelDescriptors& channels,      buffer_ptr_t& buffer, @@ -145,7 +139,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(      LLSD& context,      LLPumpIO* pump)  { -	LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_PIPE); +    LL_PROFILE_ZONE_SCOPED;  	PUMP_DEBUG;      LL_DEBUGS() << "LLSDHTTPServer::process_impl" << LL_ENDL; @@ -174,12 +168,10 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(  		std::string verb = context[CONTEXT_REQUEST][CONTEXT_VERB];  		if(verb == HTTP_VERB_GET)  		{ -			LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_GET);  			mNode.get(LLHTTPNode::ResponsePtr(mResponse), context);  		}  		else if(verb == HTTP_VERB_PUT)  		{ -			LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_PUT);  			LLSD input;  			if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD)  			{ @@ -195,7 +187,6 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(  		}  		else if(verb == HTTP_VERB_POST)  		{ -			LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_POST);  			LLSD input;  			if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD)  			{ @@ -211,7 +202,6 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(  		}  		else if(verb == HTTP_VERB_DELETE)  		{ -			LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_DELETE);  			mNode.del(LLHTTPNode::ResponsePtr(mResponse), context);  		}		  		else if(verb == HTTP_VERB_OPTIONS) @@ -455,8 +445,6 @@ protected:   * LLHTTPResponseHeader   */ -static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_HEADER("HTTP Header"); -  // virtual  LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(  	const LLChannelDescriptors& channels, @@ -465,7 +453,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(  	LLSD& context,  	LLPumpIO* pump)  { -	LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_HEADER); +    LL_PROFILE_ZONE_SCOPED;  	PUMP_DEBUG;  	if(eos)  	{ @@ -655,8 +643,6 @@ void LLHTTPResponder::markBad(  		<< "</body>\n</html>\n";  } -static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_RESPONDER("HTTP Responder"); -  // virtual  LLIOPipe::EStatus LLHTTPResponder::process_impl(  	const LLChannelDescriptors& channels, @@ -665,7 +651,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(  	LLSD& context,  	LLPumpIO* pump)  { -	LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_RESPONDER); +    LL_PROFILE_ZONE_SCOPED;  	PUMP_DEBUG;  	LLIOPipe::EStatus status = STATUS_OK; diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index a9cc71c365..321d7286eb 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -300,8 +300,6 @@ LLIOSocketReader::~LLIOSocketReader()  	//LL_DEBUGS() << "Destroying LLIOSocketReader" << LL_ENDL;  } -static LLTrace::BlockTimerStatHandle FTM_PROCESS_SOCKET_READER("Socket Reader"); -  // virtual  LLIOPipe::EStatus LLIOSocketReader::process_impl(  	const LLChannelDescriptors& channels, @@ -310,7 +308,7 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl(  	LLSD& context,  	LLPumpIO* pump)  { -	LL_RECORD_BLOCK_TIME(FTM_PROCESS_SOCKET_READER); +    LL_PROFILE_ZONE_SCOPED;  	PUMP_DEBUG;  	if(!mSource) return STATUS_PRECONDITION_NOT_MET;  	if(!mInitialized) @@ -400,7 +398,6 @@ LLIOSocketWriter::~LLIOSocketWriter()  	//LL_DEBUGS() << "Destroying LLIOSocketWriter" << LL_ENDL;  } -static LLTrace::BlockTimerStatHandle FTM_PROCESS_SOCKET_WRITER("Socket Writer");  // virtual  LLIOPipe::EStatus LLIOSocketWriter::process_impl(  	const LLChannelDescriptors& channels, @@ -409,7 +406,7 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl(  	LLSD& context,  	LLPumpIO* pump)  { -	LL_RECORD_BLOCK_TIME(FTM_PROCESS_SOCKET_WRITER); +    LL_PROFILE_ZONE_SCOPED;  	PUMP_DEBUG;  	if(!mDestination) return STATUS_PRECONDITION_NOT_MET;  	if(!mInitialized) @@ -556,7 +553,6 @@ void LLIOServerSocket::setResponseTimeout(F32 timeout_secs)  	mResponseTimeout = timeout_secs;  } -static LLTrace::BlockTimerStatHandle FTM_PROCESS_SERVER_SOCKET("Server Socket");  // virtual  LLIOPipe::EStatus LLIOServerSocket::process_impl(  	const LLChannelDescriptors& channels, @@ -565,7 +561,7 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(  	LLSD& context,  	LLPumpIO* pump)  { -	LL_RECORD_BLOCK_TIME(FTM_PROCESS_SERVER_SOCKET); +    LL_PROFILE_ZONE_SCOPED;  	PUMP_DEBUG;  	if(!pump)  	{ diff --git a/indra/llmessage/llioutil.cpp b/indra/llmessage/llioutil.cpp index b8443c0600..850bc2a616 100644 --- a/indra/llmessage/llioutil.cpp +++ b/indra/llmessage/llioutil.cpp @@ -45,7 +45,6 @@ LLIOPipe::EStatus LLIOFlush::process_impl(  } -static LLTrace::BlockTimerStatHandle FTM_PROCESS_SLEEP("IO Sleep");  /**    * @class LLIOSleep   */ @@ -56,7 +55,7 @@ LLIOPipe::EStatus LLIOSleep::process_impl(  	LLSD& context,  	LLPumpIO* pump)  { -	LL_RECORD_BLOCK_TIME(FTM_PROCESS_SLEEP); +    LL_PROFILE_ZONE_SCOPED;  	if(mSeconds > 0.0)  	{  		if(pump) pump->sleepChain(mSeconds); @@ -66,7 +65,6 @@ LLIOPipe::EStatus LLIOSleep::process_impl(  	return STATUS_DONE;  } -static LLTrace::BlockTimerStatHandle FTM_PROCESS_ADD_CHAIN("Add Chain");  /**    * @class LLIOAddChain   */ @@ -77,7 +75,7 @@ LLIOPipe::EStatus LLIOAddChain::process_impl(  	LLSD& context,  	LLPumpIO* pump)  { -	LL_RECORD_BLOCK_TIME(FTM_PROCESS_ADD_CHAIN); +    LL_PROFILE_ZONE_SCOPED;  	pump->addChain(mChain, mTimeout);  	return STATUS_DONE;  } diff --git a/indra/llmessage/llpartdata.cpp b/indra/llmessage/llpartdata.cpp index 53aa35c0f9..6664eb02dc 100644 --- a/indra/llmessage/llpartdata.cpp +++ b/indra/llmessage/llpartdata.cpp @@ -311,8 +311,9 @@ BOOL LLPartSysData::unpack(LLDataPacker &dp)  std::ostream& operator<<(std::ostream& s, const LLPartSysData &data)  {  	s << "Flags: " << std::hex << data.mFlags; -	s << " Pattern: " << std::hex << (U32) data.mPattern << "\n"; -	s << "Age: [" << data.mStartAge << ", " << data.mMaxAge << "]\n"; +	s << "Pattern: " << std::hex << (U32) data.mPattern << "\n"; +	s << "Source Age: [" << data.mStartAge << ", " << data.mMaxAge << "]\n"; +    s << "Particle Age: " << data.mPartData.mMaxAge << "\n";  	s << "Angle: [" << data.mInnerAngle << ", " << data.mOuterAngle << "]\n";  	s << "Burst Rate: " << data.mBurstRate << "\n";  	s << "Burst Radius: " << data.mBurstRadius << "\n"; diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index a2524e9804..44720f0015 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -416,9 +416,6 @@ void LLPumpIO::pump()  	pump(DEFAULT_POLL_TIMEOUT);  } -static LLTrace::BlockTimerStatHandle FTM_PUMP_IO("Pump IO"); -static LLTrace::BlockTimerStatHandle FTM_PUMP_POLL("Pump Poll"); -  LLPumpIO::current_chain_t LLPumpIO::removeRunningChain(LLPumpIO::current_chain_t& run_chain)   {  	std::for_each( @@ -431,7 +428,7 @@ LLPumpIO::current_chain_t LLPumpIO::removeRunningChain(LLPumpIO::current_chain_t  //timeout is in microseconds  void LLPumpIO::pump(const S32& poll_timeout)  { -	LL_RECORD_BLOCK_TIME(FTM_PUMP_IO); +    LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;  	//LL_INFOS() << "LLPumpIO::pump()" << LL_ENDL;  	// Run any pending runners. @@ -509,7 +506,7 @@ void LLPumpIO::pump(const S32& poll_timeout)  		S32 count = 0;  		S32 client_id = 0;          { -			LL_RECORD_BLOCK_TIME(FTM_PUMP_POLL); +            LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;              apr_pollset_poll(mPollset, poll_timeout, &count, &poll_fd);          }  		PUMP_DEBUG; @@ -737,10 +734,9 @@ bool LLPumpIO::respond(  	return true;  } -static LLTrace::BlockTimerStatHandle FTM_PUMP_CALLBACK_CHAIN("Chain"); -  void LLPumpIO::callback()  { +    LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;  	//LL_INFOS() << "LLPumpIO::callback()" << LL_ENDL;  	if(true)  	{ @@ -756,7 +752,6 @@ void LLPumpIO::callback()  		callbacks_t::iterator end = mCallbacks.end();  		for(; it != end; ++it)  		{ -			LL_RECORD_BLOCK_TIME(FTM_PUMP_CALLBACK_CHAIN);  			// it's always the first and last time for respone chains  			(*it).mHead = (*it).mChainLinks.begin();  			(*it).mInit = true; diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index 6d5ad0ba08..32f79f0546 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -533,6 +533,8 @@ static LLTrace::BlockTimerStatHandle FTM_PROCESS_MESSAGES("Process Messages");  // decode a given message  BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender )  { +    LL_RECORD_BLOCK_TIME(FTM_PROCESS_MESSAGES); +  	llassert( mReceiveSize >= 0 );  	llassert( mCurrentRMessageTemplate);  	llassert( !mCurrentRMessageData ); @@ -707,12 +709,9 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender  			decode_timer.reset();  		} +		if( !mCurrentRMessageTemplate->callHandlerFunc(gMessageSystem) )  		{ -			LL_RECORD_BLOCK_TIME(FTM_PROCESS_MESSAGES); -			if( !mCurrentRMessageTemplate->callHandlerFunc(gMessageSystem) ) -			{ -				LL_WARNS() << "Message from " << sender << " with no handler function received: " << mCurrentRMessageTemplate->mName << LL_ENDL; -			} +			LL_WARNS() << "Message from " << sender << " with no handler function received: " << mCurrentRMessageTemplate->mName << LL_ENDL;  		}  		if(LLMessageReader::getTimeDecodes() || gMessageSystem->getTimingCallback()) diff --git a/indra/llmessage/llthrottle.cpp b/indra/llmessage/llthrottle.cpp index 7605da4d3f..935af2aa5a 100644 --- a/indra/llmessage/llthrottle.cpp +++ b/indra/llmessage/llthrottle.cpp @@ -374,7 +374,6 @@ BOOL LLThrottleGroup::dynamicAdjust()  	}  	mDynamicAdjustTime = mt_sec; -	S32 total = 0;  	// Update historical information  	for (i = 0; i < TC_EOF; i++)  	{ @@ -391,7 +390,6 @@ BOOL LLThrottleGroup::dynamicAdjust()  		}  		mBitsSentThisPeriod[i] = 0; -		total += ll_round(mBitsSentHistory[i]);  	}  	// Look for busy channels diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp index 80ed3340c6..027283232d 100644 --- a/indra/llmessage/lltransfersourceasset.cpp +++ b/indra/llmessage/lltransfersourceasset.cpp @@ -32,7 +32,7 @@  #include "message.h"  #include "lldatapacker.h"  #include "lldir.h" -#include "llvfile.h" +#include "llfilesystem.h"  LLTransferSourceAsset::LLTransferSourceAsset(const LLUUID &request_id, const F32 priority) :  	LLTransferSource(LLTST_ASSET, request_id, priority), @@ -99,7 +99,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id,  		return LLTS_SKIP;  	} -	LLVFile vf(gAssetStorage->mVFS, mParams.getAssetID(), mParams.getAssetType(), LLVFile::READ); +	LLFileSystem vf(mParams.getAssetID(), mParams.getAssetType(), LLFileSystem::READ);  	if (!vf.getSize())  	{ @@ -171,7 +171,7 @@ BOOL LLTransferSourceAsset::unpackParams(LLDataPacker &dp)  } -void LLTransferSourceAsset::responderCallback(LLVFS *vfs, const LLUUID& uuid, LLAssetType::EType type, +void LLTransferSourceAsset::responderCallback(const LLUUID& uuid, LLAssetType::EType type,  											  void *user_data, S32 result, LLExtStat ext_status )  {  	LLUUID *tidp = ((LLUUID*) user_data); @@ -198,7 +198,7 @@ void LLTransferSourceAsset::responderCallback(LLVFS *vfs, const LLUUID& uuid, LL  	if (LL_ERR_NOERR == result)  	{  		// Everything's OK. -		LLVFile vf(gAssetStorage->mVFS, uuid, type, LLVFile::READ); +		LLFileSystem vf(uuid, type, LLFileSystem::READ);  		tsap->mSize = vf.getSize();  		status = LLTS_OK;  	} diff --git a/indra/llmessage/lltransfersourceasset.h b/indra/llmessage/lltransfersourceasset.h index 3abda83cf8..585e683cb3 100644 --- a/indra/llmessage/lltransfersourceasset.h +++ b/indra/llmessage/lltransfersourceasset.h @@ -30,7 +30,7 @@  #include "lltransfermanager.h"  #include "llassetstorage.h" -class LLVFile; +class LLFileSystem;  class LLTransferSourceParamsAsset : public LLTransferSourceParams  { @@ -56,7 +56,7 @@ public:  	LLTransferSourceAsset(const LLUUID &request_id, const F32 priority);  	virtual ~LLTransferSourceAsset(); -	static void responderCallback(LLVFS *vfs, const LLUUID& uuid, LLAssetType::EType type, +	static void responderCallback(const LLUUID& uuid, LLAssetType::EType type,  								  void *user_data, S32 result, LLExtStat ext_status );  protected:  	/*virtual*/ void initTransfer(); diff --git a/indra/llmessage/lltransfertargetvfile.cpp b/indra/llmessage/lltransfertargetvfile.cpp index b27f0881e0..f6faadf87f 100644 --- a/indra/llmessage/lltransfertargetvfile.cpp +++ b/indra/llmessage/lltransfertargetvfile.cpp @@ -30,7 +30,7 @@  #include "lldatapacker.h"  #include "llerror.h" -#include "llvfile.h" +#include "llfilesystem.h"  //static  void LLTransferTargetVFile::updateQueue(bool shutdown) @@ -138,10 +138,9 @@ LLTSCode LLTransferTargetVFile::dataCallback(const S32 packet_id, U8 *in_datap,  	//LL_INFOS() << "LLTransferTargetFile::dataCallback" << LL_ENDL;  	//LL_INFOS() << "Packet: " << packet_id << LL_ENDL; -	LLVFile vf(gAssetStorage->mVFS, mTempID, mParams.getAssetType(), LLVFile::APPEND); +	LLFileSystem vf(mTempID, mParams.getAssetType(), LLFileSystem::APPEND);  	if (mNeedsCreate)  	{ -		vf.setMaxSize(mSize);  		mNeedsCreate = FALSE;  	} @@ -176,7 +175,7 @@ void LLTransferTargetVFile::completionCallback(const LLTSCode status)  	  case LLTS_DONE:  		if (!mNeedsCreate)  		{ -			LLVFile file(gAssetStorage->mVFS, mTempID, mParams.getAssetType(), LLVFile::WRITE); +			LLFileSystem file(mTempID, mParams.getAssetType(), LLFileSystem::WRITE);  			if (!file.rename(mParams.getAssetID(), mParams.getAssetType()))  			{  				LL_ERRS() << "LLTransferTargetVFile: rename failed" << LL_ENDL; @@ -195,7 +194,7 @@ void LLTransferTargetVFile::completionCallback(const LLTSCode status)  	  {  		  // We're aborting this transfer, we don't want to keep this file.  		  LL_WARNS() << "Aborting vfile transfer for " << mParams.getAssetID() << LL_ENDL; -		  LLVFile vf(gAssetStorage->mVFS, mTempID, mParams.getAssetType(), LLVFile::APPEND); +		  LLFileSystem vf(mTempID, mParams.getAssetType(), LLFileSystem::APPEND);  		  vf.remove();  	  }  	  break; diff --git a/indra/llmessage/lltransfertargetvfile.h b/indra/llmessage/lltransfertargetvfile.h index c819c1e2f2..39a9125f1b 100644 --- a/indra/llmessage/lltransfertargetvfile.h +++ b/indra/llmessage/lltransfertargetvfile.h @@ -29,9 +29,9 @@  #include "lltransfermanager.h"  #include "llassetstorage.h" -#include "llvfile.h" +#include "llfilesystem.h" -class LLVFile; +class LLFileSystem;  // Lame, an S32 for now until I figure out the deal with how we want to do  // error codes. diff --git a/indra/llmessage/llxfer_vfile.cpp b/indra/llmessage/llxfer_vfile.cpp index ddc24342f6..12419b342d 100644 --- a/indra/llmessage/llxfer_vfile.cpp +++ b/indra/llmessage/llxfer_vfile.cpp @@ -30,8 +30,7 @@  #include "lluuid.h"  #include "llerror.h"  #include "llmath.h" -#include "llvfile.h" -#include "llvfs.h" +#include "llfilesystem.h"  #include "lldir.h"  // size of chunks read from/written to disk @@ -42,13 +41,13 @@ const U32 LL_MAX_XFER_FILE_BUFFER = 65536;  LLXfer_VFile::LLXfer_VFile ()  : LLXfer(-1)  { -	init(NULL, LLUUID::null, LLAssetType::AT_NONE); +	init(LLUUID::null, LLAssetType::AT_NONE);  } -LLXfer_VFile::LLXfer_VFile (LLVFS *vfs, const LLUUID &local_id, LLAssetType::EType type) +LLXfer_VFile::LLXfer_VFile (const LLUUID &local_id, LLAssetType::EType type)  : LLXfer(-1)  { -	init(vfs, local_id, type); +	init(local_id, type);  }  /////////////////////////////////////////////////////////// @@ -60,10 +59,8 @@ LLXfer_VFile::~LLXfer_VFile ()  /////////////////////////////////////////////////////////// -void LLXfer_VFile::init (LLVFS *vfs, const LLUUID &local_id, LLAssetType::EType type) +void LLXfer_VFile::init (const LLUUID &local_id, LLAssetType::EType type)  { - -	mVFS = vfs;  	mLocalID = local_id;  	mType = type; @@ -82,14 +79,14 @@ void LLXfer_VFile::cleanup ()  	if (mTempID.notNull() &&  		mDeleteTempFile)  	{ -		if (mVFS->getExists(mTempID, mType)) +		if (LLFileSystem::getExists(mTempID, mType))  		{ -			LLVFile file(mVFS, mTempID, mType, LLVFile::WRITE); +			LLFileSystem file(mTempID, mType, LLFileSystem::WRITE);  			file.remove();  		}  		else  		{ -			LL_WARNS("Xfer") << "LLXfer_VFile::cleanup() can't open to delete VFS file " << mTempID << "." << LLAssetType::lookup(mType)		 +			LL_WARNS("Xfer") << "LLXfer_VFile::cleanup() can't open to delete cache file " << mTempID << "." << LLAssetType::lookup(mType)		  				<< ", mRemoteID is " << mRemoteID << LL_ENDL;  		}  	} @@ -103,7 +100,6 @@ void LLXfer_VFile::cleanup ()  ///////////////////////////////////////////////////////////  S32 LLXfer_VFile::initializeRequest(U64 xfer_id, -									LLVFS* vfs,  									const LLUUID& local_id,  									const LLUUID& remote_id,  									LLAssetType::EType type, @@ -115,7 +111,6 @@ S32 LLXfer_VFile::initializeRequest(U64 xfer_id,  	mRemoteHost = remote_host; -	mVFS = vfs;  	mLocalID = local_id;  	mRemoteID = remote_id;  	mType = type; @@ -192,13 +187,13 @@ S32 LLXfer_VFile::startSend (U64 xfer_id, const LLHost &remote_host)  	delete mVFile;  	mVFile = NULL; -	if(mVFS->getExists(mLocalID, mType)) +	if(LLFileSystem::getExists(mLocalID, mType))  	{ -		mVFile = new LLVFile(mVFS, mLocalID, mType, LLVFile::READ); +		mVFile = new LLFileSystem(mLocalID, mType, LLFileSystem::READ);  		if (mVFile->getSize() <= 0)  		{ -			LL_WARNS("Xfer") << "LLXfer_VFile::startSend() VFS file " << mLocalID << "." << LLAssetType::lookup(mType)		 +			LL_WARNS("Xfer") << "LLXfer_VFile::startSend() cache file " << mLocalID << "." << LLAssetType::lookup(mType)		  				<< " has unexpected file size of " << mVFile->getSize() << LL_ENDL;  			delete mVFile;  			mVFile = NULL; @@ -214,7 +209,7 @@ S32 LLXfer_VFile::startSend (U64 xfer_id, const LLHost &remote_host)  	}  	else  	{ -		LL_WARNS("Xfer") << "LLXfer_VFile::startSend() can't read VFS file " << mLocalID << "." << LLAssetType::lookup(mType) << LL_ENDL; +		LL_WARNS("Xfer") << "LLXfer_VFile::startSend() can't read cache file " << mLocalID << "." << LLAssetType::lookup(mType) << LL_ENDL;  		retval = LL_ERR_FILE_NOT_FOUND;  	} @@ -240,13 +235,13 @@ S32 LLXfer_VFile::reopenFileHandle()  	if (mVFile == NULL)  	{ -		if (mVFS->getExists(mLocalID, mType)) +		if (LLFileSystem::getExists(mLocalID, mType))  		{ -			mVFile = new LLVFile(mVFS, mLocalID, mType, LLVFile::READ); +			mVFile = new LLFileSystem(mLocalID, mType, LLFileSystem::READ);  		}  		else  		{ -			LL_WARNS("Xfer") << "LLXfer_VFile::reopenFileHandle() can't read VFS file " << mLocalID << "." << LLAssetType::lookup(mType) << LL_ENDL; +			LL_WARNS("Xfer") << "LLXfer_VFile::reopenFileHandle() can't read cache file " << mLocalID << "." << LLAssetType::lookup(mType) << LL_ENDL;  			retval = LL_ERR_FILE_NOT_FOUND;  		}  	} @@ -265,8 +260,7 @@ void LLXfer_VFile::setXferSize (S32 xfer_size)  	// It would be nice if LLXFers could tell which end of the pipe they were  	if (! mVFile)  	{ -		LLVFile file(mVFS, mTempID, mType, LLVFile::APPEND); -		file.setMaxSize(xfer_size); +		LLFileSystem file(mTempID, mType, LLFileSystem::APPEND);  	}  } @@ -320,7 +314,7 @@ S32 LLXfer_VFile::flush()  	S32 retval = 0;  	if (mBufferLength)  	{ -		LLVFile file(mVFS, mTempID, mType, LLVFile::APPEND); +		LLFileSystem file(mTempID, mType, LLFileSystem::APPEND);  		file.write((U8*)mBuffer, mBufferLength); @@ -340,22 +334,15 @@ S32 LLXfer_VFile::processEOF()  	if (!mCallbackResult)  	{ -		if (mVFS->getExists(mTempID, mType)) +		if (LLFileSystem::getExists(mTempID, mType))  		{ -			LLVFile file(mVFS, mTempID, mType, LLVFile::WRITE); +			LLFileSystem file(mTempID, mType, LLFileSystem::WRITE);  			if (!file.rename(mLocalID, mType))  			{ -				LL_WARNS("Xfer") << "VFS rename of temp file failed: unable to rename " << mTempID << " to " << mLocalID << LL_ENDL; +				LL_WARNS("Xfer") << "Cache rename of temp file failed: unable to rename " << mTempID << " to " << mLocalID << LL_ENDL;  			}  			else -			{					 -				#ifdef VFS_SPAM -				// Debugging spam -				LL_INFOS("Xfer") << "VFS rename of temp file done: renamed " << mTempID << " to " << mLocalID  -					<< " LLVFile size is " << file.getSize() -					<< LL_ENDL; -				#endif				 -				 +			{									  				// Rename worked: the original file is gone.   Clear mDeleteTempFile  				// so we don't attempt to delete the file in cleanup()  				mDeleteTempFile = FALSE; @@ -363,7 +350,7 @@ S32 LLXfer_VFile::processEOF()  		}  		else  		{ -			LL_WARNS("Xfer") << "LLXfer_VFile::processEOF() can't open for renaming VFS file " << mTempID << "." << LLAssetType::lookup(mType) << LL_ENDL; +			LL_WARNS("Xfer") << "LLXfer_VFile::processEOF() can't open for renaming cache file " << mTempID << "." << LLAssetType::lookup(mType) << LL_ENDL;  		}  	} diff --git a/indra/llmessage/llxfer_vfile.h b/indra/llmessage/llxfer_vfile.h index 5bf9a5cfba..d82bab5f6c 100644 --- a/indra/llmessage/llxfer_vfile.h +++ b/indra/llmessage/llxfer_vfile.h @@ -30,8 +30,7 @@  #include "llxfer.h"  #include "llassetstorage.h" -class LLVFS; -class LLVFile; +class LLFileSystem;  class LLXfer_VFile : public LLXfer  { @@ -41,9 +40,7 @@ class LLXfer_VFile : public LLXfer  	LLUUID mTempID;  	LLAssetType::EType mType; -	LLVFile *mVFile; - -	LLVFS *mVFS; +	LLFileSystem *mVFile;  	std::string mName; @@ -51,14 +48,13 @@ class LLXfer_VFile : public LLXfer   public:  	LLXfer_VFile (); -	LLXfer_VFile (LLVFS *vfs, const LLUUID &local_id, LLAssetType::EType type); +	LLXfer_VFile (const LLUUID &local_id, LLAssetType::EType type);  	virtual ~LLXfer_VFile(); -	virtual void init(LLVFS *vfs, const LLUUID &local_id, LLAssetType::EType type); +	virtual void init(const LLUUID &local_id, LLAssetType::EType type);  	virtual void cleanup();  	virtual S32 initializeRequest(U64 xfer_id, -			LLVFS *vfs,  			const LLUUID &local_id,  			const LLUUID &remote_id,  			const LLAssetType::EType type, diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp index 4cea886c8a..f9b59d7e42 100644 --- a/indra/llmessage/llxfermanager.cpp +++ b/indra/llmessage/llxfermanager.cpp @@ -56,9 +56,9 @@ const S32 LL_DEFAULT_MAX_HARD_LIMIT_SIMULTANEOUS_XFERS = 500;  /////////////////////////////////////////////////////////// -LLXferManager::LLXferManager (LLVFS *vfs) +LLXferManager::LLXferManager ()  { -	init(vfs); +	init();  }  /////////////////////////////////////////////////////////// @@ -70,7 +70,7 @@ LLXferManager::~LLXferManager ()  /////////////////////////////////////////////////////////// -void LLXferManager::init (LLVFS *vfs) +void LLXferManager::init()  {  	cleanup(); @@ -78,8 +78,6 @@ void LLXferManager::init (LLVFS *vfs)  	setHardLimitOutgoingXfersPerCircuit(LL_DEFAULT_MAX_HARD_LIMIT_SIMULTANEOUS_XFERS);  	setMaxIncomingXfers(LL_DEFAULT_MAX_REQUEST_FIFO_XFERS); -	mVFS = vfs; -  	// Turn on or off ack throttling  	mUseAckThrottling = FALSE;  	setAckThrottleBPS(100000); @@ -462,7 +460,7 @@ U64 LLXferManager::requestFile(const std::string& local_filename,  void LLXferManager::requestVFile(const LLUUID& local_id,  								 const LLUUID& remote_id, -								 LLAssetType::EType type, LLVFS* vfs, +								 LLAssetType::EType type,  								 const LLHost& remote_host,  								 void (*callback)(void**,S32,LLExtStat),  								 void** user_data, @@ -508,7 +506,6 @@ void LLXferManager::requestVFile(const LLUUID& local_id,  		addToList(xfer_p, mReceiveList, is_priority);  		((LLXfer_VFile *)xfer_p)->initializeRequest(getNextID(), -			vfs,  			local_id,  			remote_id,  			type, @@ -784,33 +781,17 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user  	LLXfer *xferp;  	if (uuid != LLUUID::null) -	{	// Request for an asset - use a VFS file +	{	// Request for an asset - use a cache file  		if(NULL == LLAssetType::lookup(type))  		{  			LL_WARNS("Xfer") << "Invalid type for xfer request: " << uuid << ":"  					<< type_s16 << " to " << mesgsys->getSender() << LL_ENDL;  			return;  		} -			 -		if (! mVFS) -		{ -			LL_WARNS("Xfer") << "Attempt to send VFile w/o available VFS" << LL_ENDL; -			return; -		} - -		/* Present in fireengine, not used by viewer -		if (!validateVFileForTransfer(uuid.asString())) -		{ -			// it is up to the app sending the file to mark it for expected  -			// transfer before the request arrives or it will be dropped -			LL_WARNS("Xfer") << "SECURITY: Unapproved VFile '" << uuid << "'" << LL_ENDL; -			return; -		} -		*/  		LL_INFOS("Xfer") << "starting vfile transfer: " << uuid << "," << LLAssetType::lookup(type) << " to " << mesgsys->getSender() << LL_ENDL; -		xferp = (LLXfer *)new LLXfer_VFile(mVFS, uuid, type); +		xferp = (LLXfer *)new LLXfer_VFile(uuid, type);  		if (xferp)  		{  			mSendList.push_front(xferp); @@ -1273,9 +1254,9 @@ void LLXferManager::addToList(LLXfer* xferp, xfer_list_t & xfer_list, BOOL is_pr  LLXferManager *gXferManager = NULL; -void start_xfer_manager(LLVFS *vfs) +void start_xfer_manager()  { -	gXferManager = new LLXferManager(vfs); +	gXferManager = new LLXferManager();  }  void cleanup_xfer_manager() diff --git a/indra/llmessage/llxfermanager.h b/indra/llmessage/llxfermanager.h index 45ae2ffdd3..f49209bed0 100644 --- a/indra/llmessage/llxfermanager.h +++ b/indra/llmessage/llxfermanager.h @@ -35,7 +35,6 @@  //Forward declaration to avoid circular dependencies  class LLXfer; -class LLVFS;  #include "llxfer.h"  #include "message.h" @@ -72,9 +71,6 @@ public:  class LLXferManager  { - private: -	LLVFS *mVFS; -   protected:  	S32    mMaxOutgoingXfersPerCircuit;  	S32    mHardLimitOutgoingXfersPerCircuit;	// At this limit, kill off the connection @@ -111,10 +107,10 @@ class LLXferManager  	std::multiset<std::string> mExpectedVFileRequests;  // files that are authorized to be downloaded on top of   public: -	LLXferManager(LLVFS *vfs); +	LLXferManager();  	virtual ~LLXferManager(); -	virtual void init(LLVFS *vfs); +	virtual void init();  	virtual void cleanup();  	void setUseAckThrottling(const BOOL use); @@ -166,7 +162,7 @@ class LLXferManager  // vfile requesting  // .. to vfile  	virtual void requestVFile(const LLUUID &local_id, const LLUUID& remote_id, -							  LLAssetType::EType type, LLVFS* vfs, +							  LLAssetType::EType type,  							  const LLHost& remote_host,  							  void (*callback)(void**,S32,LLExtStat), void** user_data,  							  BOOL is_priority = FALSE); @@ -213,7 +209,7 @@ class LLXferManager  extern LLXferManager*	gXferManager;  // initialization and garbage collection -void start_xfer_manager(LLVFS *vfs); +void start_xfer_manager();  void cleanup_xfer_manager();  // message system callbacks diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index da62bb12e8..19146c64f4 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -46,6 +46,7 @@  #include "apr_poll.h"  // linden library headers +#include "llapp.h"  #include "indra_constants.h"  #include "lldir.h"  #include "llerror.h" diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index fba5b7453d..35dcbe3836 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -281,6 +281,13 @@ char const* const _PREHASH_PricePerMeter = LLMessageStringTable::getInstance()->  char const* const _PREHASH_RegionFlags = LLMessageStringTable::getInstance()->getString("RegionFlags");  char const* const _PREHASH_RegionFlagsExtended = LLMessageStringTable::getInstance()->getString("RegionFlagsExtended");  char const* const _PREHASH_RegionProtocols = LLMessageStringTable::getInstance()->getString("RegionProtocols"); +char const* const _PREHASH_ChatWhisperRange = LLMessageStringTable::getInstance()->getString("ChatWhisperRange"); +char const* const _PREHASH_ChatNormalRange = LLMessageStringTable::getInstance()->getString("ChatNormalRange"); +char const* const _PREHASH_ChatShoutRange = LLMessageStringTable::getInstance()->getString("ChatShoutRange"); +char const* const _PREHASH_ChatWhisperOffset = LLMessageStringTable::getInstance()->getString("ChatWhisperOffset"); +char const* const _PREHASH_ChatNormalOffset = LLMessageStringTable::getInstance()->getString("ChatNormalOffset"); +char const* const _PREHASH_ChatShoutOffset = LLMessageStringTable::getInstance()->getString("ChatShoutOffset"); +char const* const _PREHASH_ChatFlags = LLMessageStringTable::getInstance()->getString("ChatFlags");  char const* const _PREHASH_VoteResult = LLMessageStringTable::getInstance()->getString("VoteResult");  char const* const _PREHASH_ParcelDirFeeEstimate = LLMessageStringTable::getInstance()->getString("ParcelDirFeeEstimate");  char const* const _PREHASH_ModifyBlock = LLMessageStringTable::getInstance()->getString("ModifyBlock"); @@ -309,6 +316,7 @@ char const* const _PREHASH_DuplicateFlags = LLMessageStringTable::getInstance()-  char const* const _PREHASH_RegionInfo2 = LLMessageStringTable::getInstance()->getString("RegionInfo2");  char const* const _PREHASH_RegionInfo3 = LLMessageStringTable::getInstance()->getString("RegionInfo3");  char const* const _PREHASH_RegionInfo4 = LLMessageStringTable::getInstance()->getString("RegionInfo4"); +char const* const _PREHASH_RegionInfo5 = LLMessageStringTable::getInstance()->getString("RegionInfo5");  char const* const _PREHASH_TextColor = LLMessageStringTable::getInstance()->getString("TextColor");  char const* const _PREHASH_SlaveID = LLMessageStringTable::getInstance()->getString("SlaveID");  char const* const _PREHASH_Charter = LLMessageStringTable::getInstance()->getString("Charter"); @@ -1378,6 +1386,7 @@ char const* const _PREHASH_RegionAllowAccessBlock = LLMessageStringTable::getIns  char const* const _PREHASH_RegionAllowAccessOverride = LLMessageStringTable::getInstance()->getString("RegionAllowAccessOverride");  char const* const _PREHASH_ParcelEnvironmentBlock = LLMessageStringTable::getInstance()->getString("ParcelEnvironmentBlock");  char const* const _PREHASH_ParcelEnvironmentVersion = LLMessageStringTable::getInstance()->getString("ParcelEnvironmentVersion"); +char const* const _PREHASH_ParcelExtendedFlags = LLMessageStringTable::getInstance()->getString("ParcelExtendedFlags");  char const* const _PREHASH_RegionAllowEnvironmentOverride = LLMessageStringTable::getInstance()->getString("RegionAllowEnvironmentOverride");  char const* const _PREHASH_UCoord = LLMessageStringTable::getInstance()->getString("UCoord");  char const* const _PREHASH_VCoord = LLMessageStringTable::getInstance()->getString("VCoord"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index 4f72c01ddf..3015f438b5 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -281,6 +281,13 @@ extern char const* const _PREHASH_PricePerMeter;  extern char const* const _PREHASH_RegionFlags;  extern char const* const _PREHASH_RegionFlagsExtended;  extern char const* const _PREHASH_RegionProtocols; +extern char const* const _PREHASH_ChatWhisperRange; +extern char const* const _PREHASH_ChatNormalRange; +extern char const* const _PREHASH_ChatShoutRange; +extern char const* const _PREHASH_ChatWhisperOffset; +extern char const* const _PREHASH_ChatNormalOffset; +extern char const* const _PREHASH_ChatShoutOffset; +extern char const* const _PREHASH_ChatFlags;  extern char const* const _PREHASH_VoteResult;  extern char const* const _PREHASH_ParcelDirFeeEstimate;  extern char const* const _PREHASH_ModifyBlock; @@ -309,6 +316,7 @@ extern char const* const _PREHASH_DuplicateFlags;  extern char const* const _PREHASH_RegionInfo2;  extern char const* const _PREHASH_RegionInfo3;  extern char const* const _PREHASH_RegionInfo4; +extern char const* const _PREHASH_RegionInfo5;  extern char const* const _PREHASH_TextColor;  extern char const* const _PREHASH_SlaveID;  extern char const* const _PREHASH_Charter; @@ -1378,6 +1386,7 @@ extern char const* const _PREHASH_RegionAllowAccessBlock;  extern char const* const _PREHASH_RegionAllowAccessOverride;  extern char const* const _PREHASH_ParcelEnvironmentBlock;  extern char const* const _PREHASH_ParcelEnvironmentVersion; +extern char const* const _PREHASH_ParcelExtendedFlags;  extern char const* const _PREHASH_RegionAllowEnvironmentOverride;  extern char const* const _PREHASH_UCoord;  extern char const* const _PREHASH_VCoord; diff --git a/indra/llmessage/tests/test_llsdmessage_peer.py b/indra/llmessage/tests/test_llsdmessage_peer.py index 9cd2959ea1..5ba0749e31 100755 --- a/indra/llmessage/tests/test_llsdmessage_peer.py +++ b/indra/llmessage/tests/test_llsdmessage_peer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3  """\  @file   test_llsdmessage_peer.py  @author Nat Goodspeed @@ -31,7 +31,7 @@ $/LicenseInfo$  import os  import sys -from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler +from http.server import HTTPServer, BaseHTTPRequestHandler  from llbase.fastest_elementtree import parse as xml_parse  from llbase import llsd @@ -165,7 +165,7 @@ if __name__ == "__main__":          # "Then there's Windows"          # Instantiate a Server(TestHTTPRequestHandler) on the first free port          # in the specified port range. -        httpd, port = freeport(xrange(8000, 8020), make_server) +        httpd, port = freeport(range(8000, 8020), make_server)      # Pass the selected port number to the subject test program via the      # environment. We don't want to impose requirements on the test program's diff --git a/indra/llmessage/tests/testrunner.py b/indra/llmessage/tests/testrunner.py index c25945067e..47c09ca245 100755 --- a/indra/llmessage/tests/testrunner.py +++ b/indra/llmessage/tests/testrunner.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3  """\  @file   testrunner.py  @author Nat Goodspeed @@ -41,7 +41,7 @@ VERBOSE = not re.match(r"(0|off|false|quiet)$", VERBOSE, re.IGNORECASE)  if VERBOSE:      def debug(fmt, *args): -        print fmt % args +        print(fmt % args)          sys.stdout.flush()  else:      debug = lambda *args: None @@ -99,14 +99,14 @@ def freeport(portlist, expr):          # error because we can't return meaningful values. We have no 'port',          # therefore no 'expr(port)'.          portiter = iter(portlist) -        port = portiter.next() +        port = next(portiter)          while True:              try:                  # If this value of port works, return as promised.                  value = expr(port) -            except socket.error, err: +            except socket.error as err:                  # Anything other than 'Address already in use', propagate                  if err.args[0] != errno.EADDRINUSE:                      raise @@ -117,9 +117,9 @@ def freeport(portlist, expr):                  type, value, tb = sys.exc_info()                  try:                      try: -                        port = portiter.next() +                        port = next(portiter)                      except StopIteration: -                        raise type, value, tb +                        raise type(value).with_traceback(tb)                  finally:                      # Clean up local traceback, see docs for sys.exc_info()                      del tb @@ -138,7 +138,7 @@ def freeport(portlist, expr):              # If we've actually arrived at this point, portiter.next() delivered a              # new port value. Loop back to pass that to expr(port). -    except Exception, err: +    except Exception as err:          debug("*** freeport() raising %s: %s", err.__class__.__name__, err)          raise @@ -227,13 +227,13 @@ def test_freeport():      def exc(exception_class, *args):          try:              yield -        except exception_class, err: +        except exception_class as err:              for i, expected_arg in enumerate(args):                  assert expected_arg == err.args[i], \                         "Raised %s, but args[%s] is %r instead of %r" % \                         (err.__class__.__name__, i, err.args[i], expected_arg) -            print "Caught expected exception %s(%s)" % \ -                  (err.__class__.__name__, ', '.join(repr(arg) for arg in err.args)) +            print("Caught expected exception %s(%s)" % \ +                  (err.__class__.__name__, ', '.join(repr(arg) for arg in err.args)))          else:              assert False, "Failed to raise " + exception_class.__class__.__name__ @@ -270,18 +270,18 @@ def test_freeport():      # This is the magic exception that should prompt us to retry      inuse = socket.error(errno.EADDRINUSE, 'Address already in use')      # Get the iterator to our ports list so we can check later if we've used all -    ports = iter(xrange(5)) +    ports = iter(range(5))      with exc(socket.error, errno.EADDRINUSE):          freeport(ports, lambda port: raiser(inuse))      # did we entirely exhaust 'ports'?      with exc(StopIteration): -        ports.next() +        next(ports) -    ports = iter(xrange(2)) +    ports = iter(range(2))      # Any exception but EADDRINUSE should quit immediately      with exc(SomeError):          freeport(ports, lambda port: raiser(SomeError())) -    assert_equals(ports.next(), 1) +    assert_equals(next(ports), 1)      # ----------- freeport() with platform-dependent socket stuff ------------      # This is what we should've had unit tests to begin with (see CHOP-661). @@ -290,14 +290,14 @@ def test_freeport():          sock.bind(('127.0.0.1', port))          return sock -    bound0, port0 = freeport(xrange(7777, 7780), newbind) +    bound0, port0 = freeport(range(7777, 7780), newbind)      assert_equals(port0, 7777) -    bound1, port1 = freeport(xrange(7777, 7780), newbind) +    bound1, port1 = freeport(range(7777, 7780), newbind)      assert_equals(port1, 7778) -    bound2, port2 = freeport(xrange(7777, 7780), newbind) +    bound2, port2 = freeport(range(7777, 7780), newbind)      assert_equals(port2, 7779)      with exc(socket.error, errno.EADDRINUSE): -        bound3, port3 = freeport(xrange(7777, 7780), newbind) +        bound3, port3 = freeport(range(7777, 7780), newbind)  if __name__ == "__main__":      test_freeport() | 
