Exemplo n.º 1
0
        public AssetBase GetAsset(UUID assetID, AssetRequestInfo reqInfo)
        {
            // This function returns true if it's cached as a null and not expired.
            if (IsNegativeCached(assetID))
            {
                return(null);
            }

            // Else, we need to fetch the asset.
            reqInfo.AssetId = assetID;
            AssetBase asset = m_assetServer.RequestAssetSync(assetID);

            if (asset == null)
            {
                StampNegativeCache(assetID);
            }

            if (this.IsAssetRetrievalAllowed(asset, reqInfo))
            {
                StatsManager.SimExtraStats.AddAssetRequestTime((long)reqInfo.RequestDuration);
                return(asset);
            }

            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Tries to retrieve the asset with the given id
        /// </summary>
        /// <param name="assetID"></param>
        /// <param name="server"></param>
        /// <param name="asset"></param>
        /// <returns></returns>
        private bool TryRequestAsset(OpenMetaverse.UUID assetID, IAssetServer server, out AssetBase asset)
        {
            try
            {
                asset = server.RequestAssetSync(assetID);
            }
            catch (AssetServerException e)
            {
                asset = null;
                m_log.ErrorFormat("[InWorldz.Stratus]: Unable to retrieve asset {0}: {1}", assetID, e);
            }

            return(asset != null);
        }
        /// <summary>
        /// Tries to retrieve the asset with the given id
        /// </summary>
        /// <param name="assetID"></param>
        /// <param name="server"></param>
        /// <param name="asset"></param>
        /// <returns></returns>
        private bool TryRequestAsset(OpenMetaverse.UUID assetID, IAssetServer server, out AssetBase asset)
        {
            try
            {
                asset = server.RequestAssetSync(assetID);
            }
            catch (AssetServerException e)
            {
                asset = null;
                m_log.ErrorFormat("[InWorldz.Stratus]: Unable to retrieve asset {0}: {1}", assetID, e);
            }

            return asset != null;
        }