Exemplo n.º 1
0
        private void HandleAssetReceived(UUID assetId, AssetBase asset, AssetRequestInfo reqInfo)
        {
            // This must be done before the IsAssetRetrievalAllowed check which can turn it to null.
            if (asset == null)
                this.StampNegativeCache(reqInfo.AssetId);
            else
                this.RemoveFromNegativeCache(reqInfo.AssetId);

            if (this.IsAssetRetrievalAllowed(asset, reqInfo))
            {
                reqInfo.Callback(assetId, asset);
            }
            else
            {
                reqInfo.Callback(assetId, null);
            }
        }
Exemplo n.º 2
0
 public virtual void AssetError(UUID assetId, Exception e, AssetRequestInfo reqInfo)
 {
     m_log.WarnFormat("[ASSET CACHE]: Error while retrieving asset {0}: {1}", assetId, e.Message);
     this.StartAssetReceived(assetId, null, reqInfo);
 }
Exemplo n.º 3
0
 private void StartAssetReceived(UUID uUID, AssetBase asset, AssetRequestInfo reqInfo)
 {
     _pool.QueueWorkItem(
         new Action<UUID, AssetBase, AssetRequestInfo>(HandleAssetReceived),
         uUID, asset, reqInfo);
 }
Exemplo n.º 4
0
 // See IAssetReceiver
 public virtual void AssetReceived(AssetBase asset, AssetRequestInfo rdata)
 {
     StatsManager.SimExtraStats.AddAssetRequestTime((long)rdata.RequestDuration);
     this.RemoveFromNegativeCache(asset.FullID);
     this.StartAssetReceived(asset.FullID, asset, rdata);
 }
Exemplo n.º 5
0
        // See IAssetReceiver
        public virtual void AssetNotFound(UUID assetId, AssetRequestInfo reqInfo)
        {
//            m_log.WarnFormat("[ASSET CACHE]: AssetNotFound or transfer otherwise blocked for {0}", assetId);
            this.StampNegativeCache(assetId);
            this.StartAssetReceived(assetId, null, reqInfo);
        }
Exemplo n.º 6
0
 public void SendAsset(AssetBase asset, AssetRequestInfo req)
 {
 }
 //see IAssetReceiver
 public void AssetReceived(AssetBase asset, AssetRequestInfo data)
 {
     _assetReceiver.AssetReceived(asset, data);
 }
Exemplo n.º 8
0
        private bool IsAssetRetrievalAllowed(AssetBase asset, AssetRequestInfo requestInfo)
        {
            if (asset == null)
            {
                return true;
            }

            //do not pass back object assets to the net
            if (asset.Type == (sbyte)AssetType.Object &&
                requestInfo.Origin == AssetRequestInfo.RequestOrigin.SRC_NET)
            {
                m_log.WarnFormat("Not allowing access to OBJECT asset {0} from SRC_NET", requestInfo.AssetId);
                return false;
            }

            //dont pass back full script text via LLSTS_ASSET
            if ((asset.Type == (sbyte)AssetType.LSLText || asset.Type == (sbyte)AssetType.Notecard) &&
                requestInfo.Origin == AssetRequestInfo.RequestOrigin.SRC_NET &&
                (requestInfo.NetSource != AssetRequestInfo.NetSourceType.LLTST_SIM_INV_ITEM &&
                requestInfo.NetSource != AssetRequestInfo.NetSourceType.LLTST_SIM_ESTATE))
            {
                m_log.WarnFormat("Not allowing access to LSLText or asset {0} from SRC_NET and LLTST_ASSET", requestInfo.AssetId);
                return false;
            }

            return true;
        }
Exemplo n.º 9
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.º 10
0
        public void RequestAsset(OpenMetaverse.UUID assetID, AssetRequestInfo args)
        {
            try
            {
                _readWhipServer.GetAssetAsync(assetID.ToString(),
                    delegate(Asset asset, AssetServerError e)
                    {
                        if (e == null)
                        {
                            //no error, pass asset to caller
                            _receiver.AssetReceived(WhipAssetToOpensim(asset), args);
                        }
                        else
                        {
                            string errorString = e.ToString();
                            if (!errorString.Contains("not found"))
                            {
                                //there is an error, log it, and then tell the caller we have no asset to give
                                _log.ErrorFormat(
                                    "[WHIP.AssetClient]: Failure fetching asset {0}" + Environment.NewLine + errorString
                                    + Environment.NewLine, assetID);
                            }

                            _receiver.AssetNotFound(assetID, args);
                        }
                    }
                );
            }
            catch (AssetServerError e)
            {
                //there is an error, log it, and then tell the caller we have no asset to give
                string errorString = e.ToString();
                if (!errorString.Contains("not found"))
                {
                    _log.ErrorFormat(
                        "[WHIP.AssetClient]: Failure fetching asset {0}" + Environment.NewLine + errorString
                        + Environment.NewLine, assetID);
                }

                _receiver.AssetNotFound(assetID, args);
            }
        }
Exemplo n.º 11
0
 public void GetAsset(UUID assetId, AssetRequestCallback callback, AssetRequestInfo requestInfo)
 {
     requestInfo.AssetId = assetId;
     requestInfo.Callback = callback;
     if (IsNegativeCached(assetId))
         callback(assetId, null);
     else
         m_assetServer.RequestAsset(assetId, requestInfo);
 }
Exemplo n.º 12
0
 public void HandleAssetCallback(OpenMetaverse.UUID assetID, AssetRequestInfo data, Exception error)
 {
     //if not found and this is the first try, try the second server
     if (_secondReadServer != null && data.ServerNumber == 0)
     {
         data.ServerNumber++;
         _secondReadServer.RequestAsset(assetID, data);
     }
     else
     {
         if (error == null)
         {
             _assetReceiver.AssetNotFound(assetID, data);
         }
         else
         {
             _assetReceiver.AssetError(assetID, error, data);
         }
     }
 }
Exemplo n.º 13
0
 public void AssetError(OpenMetaverse.UUID assetID, Exception error, AssetRequestInfo data)
 {
     m_log.ErrorFormat("[InWorldz.Stratus]: Error while requesting asset {0}: {1}", assetID, error);
     this.HandleAssetCallback(assetID, data, error);
 }
Exemplo n.º 14
0
 //see IAssetReceiver
 public void AssetNotFound(OpenMetaverse.UUID assetID, AssetRequestInfo data)
 {
     this.HandleAssetCallback(assetID, data, null);
 }
Exemplo n.º 15
0
        public void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest)
        {
            AssetRequestInfo reqInfo = new AssetRequestInfo(transferRequest, userInfo);
            reqInfo.Callback =
                delegate(UUID assetId, AssetBase asset)
                {
                    this.ProcessDirectAssetRequest(userInfo, asset, reqInfo);
                };

            m_assetServer.RequestAsset(reqInfo.AssetId, reqInfo);
        }
Exemplo n.º 16
0
        private bool IsAssetStorageAllowed(AssetBase asset, AssetRequestInfo requestInfo)
        {
            if (asset == null)
            {
                return false;
            }

            //do not accept object assets from the net
            if (asset.Type == (sbyte)AssetType.Object && 
                requestInfo.Origin == AssetRequestInfo.RequestOrigin.SRC_NET)
            {
                return false;
            }

            return true;
        }
Exemplo n.º 17
0
 /// <summary>
 /// Process the asset queue which sends packets directly back to the client.
 /// </summary>
 private void ProcessDirectAssetRequest(IClientAPI userInfo, AssetBase asset, AssetRequestInfo req)
 {
    userInfo.SendAsset(asset, req);
 }
Exemplo n.º 18
0
        public void AddAsset(AssetBase asset, AssetRequestInfo requestInfo)
        {
            requestInfo.AssetId = asset.FullID;
            if (this.IsAssetStorageAllowed(asset, requestInfo))
            {
                ulong startTime = Util.GetLongTickCount();

                try
                {
                    RemoveFromNegativeCache(asset.FullID);
                    m_assetServer.StoreAsset(asset);
                }
                catch (AssetAlreadyExistsException e)
                {
                    //Don't rethrow this exception. AssetServerExceptions thrown from here
                    //will trigger a message on the client
                    m_log.WarnFormat("[ASSET CACHE] Not storing asset that already exists: {0}", e.Message);
                }

                StatsManager.SimExtraStats.AddAssetWriteTime((long)(Util.GetLongTickCount() - startTime));
            }
            else
            {
                throw new NotSupportedException(String.Format("Not allowing asset storage ID:{0} Type:{1} Source:{2}",
                    asset.ID, asset.Type, requestInfo.Origin));
            }

            //we will save the local asset issue for later as its confusing as hell and even LL isnt
            //very clear on it.  It looks like baked textures, possibly body parts, etc are all
            //marked as local.  from what I can gather this means that the asset is stored locally
            //on this server, but, and this makes no sense, can be requested by other servers.
            //on this case why not put it on the asset cluster since it's central anyways?
            //i could see bakes getting stored locally and regenerated for every sim corssing (i guess)
            //but this isnt even the case.  so im leaving this for now and everything is going to
            //the asset server
        }
Exemplo n.º 19
0
        /// <summary>
        /// Requests and asset and responds asynchronously
        /// </summary>
        /// <param name="assetID"></param>
        /// <param name="args"></param>
        public void RequestAsset(OpenMetaverse.UUID assetID, AssetRequestInfo args)
        {
            _threadPool.QueueWorkItem(() => {
                try
                {
                    AssetBase asset = GetAssetInternal(assetID);

                    if (asset != null)
                    {
                        _receiver.AssetReceived(asset, args);
                    }
                    else
                    {
                        _receiver.AssetNotFound(assetID, args);
                    }
                }
                catch (Exception e)
                {
                    _receiver.AssetError(assetID, e, args);
                }
            });
        }
Exemplo n.º 20
0
 public void RequestAsset(OpenMetaverse.UUID assetID, AssetRequestInfo args)
 {
     _firstReadServer.RequestAsset(assetID, args);
 }