Beispiel #1
0
        /// <summary>
        /// Called back by the asset cache when it has the asset
        /// </summary>
        /// <param name="assetID"></param>
        /// <param name="asset"></param>
        public void AssetRequestCallback(UUID assetID, AssetBase asset)
        {
            //m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", assetID);

            if (asset != null)
            {
                // Make sure that we don't run out of memory by hogging assets in the cache
                m_assetCache.ExpireAsset(assetID);

                m_foundAssetUuids.Add(assetID);
                m_assetsArchiver.WriteAsset(asset);
            }
            else
            {
                m_notFoundAssetUuids.Add(assetID);
            }

            if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count == m_repliesRequired)
            {
                m_log.DebugFormat(
                    "[ARCHIVER]: Successfully received {0} assets and notification of {1} missing assets",
                    m_foundAssetUuids.Count, m_notFoundAssetUuids.Count);

                // We want to stop using the asset cache thread asap
                // as we now need to do the work of producing the rest of the archive
                Thread newThread = new Thread(PerformAssetsRequestCallback);
                newThread.Name = "OpenSimulator archiving thread post assets receipt";
                newThread.Start();
            }
        }