예제 #1
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);
            }
        }
예제 #2
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);
            }
        }
예제 #3
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);
         }
     }
 }
예제 #4
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);
                }
            });
        }