コード例 #1
0
        private void RunRequests()
        {
            while (true)
            {
                byte[]       idata      = null;
                bool         found      = false;
                AssetStorage foundAsset = null;
                ARequest     req        = this._assetRequests.Dequeue();
                IObjectSet   result     = db.Query(new AssetUUIDQuery(req.AssetID));
                if (result.Count > 0)
                {
                    foundAsset = (AssetStorage)result.Next();
                    found      = true;
                }

                AssetBase asset = new AssetBase();
                if (found)
                {
                    asset.FullID  = foundAsset.UUID;
                    asset.Type    = foundAsset.Type;
                    asset.InvType = foundAsset.Type;
                    asset.Name    = foundAsset.Name;
                    idata         = foundAsset.Data;
                }
                else
                {
                    asset.FullID = LLUUID.Zero;
                }
                asset.Data = idata;
                _receiver.AssetReceived(asset, req.IsTexture);
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
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);
                }
            });
        }
コード例 #4
0
        /// <summary>
        /// Process an asset request.  This method will call GetAsset(AssetRequest req)
        /// on the subclass.
        /// </summary>
        public virtual void ProcessNextRequest()
        {
            AssetRequest req = m_assetRequests.Dequeue();
            AssetBase    asset;

            try
            {
                asset = GetAsset(req);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[ASSET]: Asset request for {0} threw exception {1} - Stack Trace: {2}", req.AssetID, e, e.StackTrace);

                if (StatsManager.SimExtraStats != null)
                {
                    StatsManager.SimExtraStats.AddAssetServiceRequestFailure();
                }

                m_receiver.AssetNotFound(req.AssetID, req.IsTexture);

                return;
            }

            if (asset != null)
            {
                //m_log.DebugFormat("[ASSET]: Asset {0} received from asset server", req.AssetID);

                m_receiver.AssetReceived(asset, req.IsTexture);
            }
            else
            {
                //m_log.WarnFormat("[ASSET]: Asset {0} not found by asset server", req.AssetID);

                m_receiver.AssetNotFound(req.AssetID, req.IsTexture);
            }
        }
コード例 #5
0
 //see IAssetReceiver
 public void AssetReceived(AssetBase asset, AssetRequestInfo data)
 {
     _assetReceiver.AssetReceived(asset, data);
 }