diff options
author | Justin Clarke Casey | 2007-12-19 18:05:45 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2007-12-19 18:05:45 +0000 |
commit | 45567b71b8c3c6f2e52dacdda92671048bb3faf0 (patch) | |
tree | 97f6f09bfb255181cf1ae964f1ac09d61bc615c7 /OpenSim/Framework/Communications/Cache/AssetServerBase.cs | |
parent | Stopped module loader from re-loading .dll once for every plugin found within... (diff) | |
download | opensim-SC-45567b71b8c3c6f2e52dacdda92671048bb3faf0.zip opensim-SC-45567b71b8c3c6f2e52dacdda92671048bb3faf0.tar.gz opensim-SC-45567b71b8c3c6f2e52dacdda92671048bb3faf0.tar.bz2 opensim-SC-45567b71b8c3c6f2e52dacdda92671048bb3faf0.tar.xz |
Refactor asset request processing for consistent status information on whether an asset was actually found or not
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/AssetServerBase.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetServerBase.cs | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index 659b9c9..4d03fee 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs | |||
@@ -48,7 +48,38 @@ namespace OpenSim.Framework.Communications.Cache | |||
48 | protected abstract void StoreAsset(AssetBase asset); | 48 | protected abstract void StoreAsset(AssetBase asset); |
49 | protected abstract void CommitAssets(); | 49 | protected abstract void CommitAssets(); |
50 | 50 | ||
51 | protected abstract void ProcessRequest(AssetRequest req); | 51 | /// <summary> |
52 | /// This method must be implemented by a subclass to retrieve the asset named in the | ||
53 | /// AssetRequest. If the asset is not found, null should be returned. | ||
54 | /// </summary> | ||
55 | /// <param name="req"></param> | ||
56 | /// <returns></returns> | ||
57 | protected abstract AssetBase _ProcessRequest(AssetRequest req); | ||
58 | |||
59 | /// <summary> | ||
60 | /// Process an asset request. This method will call _ProcessRequest(AssetRequest req) | ||
61 | /// on the subclass. | ||
62 | /// </summary> | ||
63 | /// <param name="req"></param> | ||
64 | protected void ProcessRequest(AssetRequest req) | ||
65 | { | ||
66 | AssetBase asset = _ProcessRequest(req); | ||
67 | |||
68 | if (asset != null) | ||
69 | { | ||
70 | MainLog.Instance.Verbose( | ||
71 | "ASSET", "Asset {0} received from asset server", req.AssetID); | ||
72 | |||
73 | _receiver.AssetReceived(asset, req.IsTexture); | ||
74 | } | ||
75 | else | ||
76 | { | ||
77 | MainLog.Instance.Error( | ||
78 | "ASSET", "Asset {0} not found by asset server", req.AssetID); | ||
79 | |||
80 | _receiver.AssetNotFound(req.AssetID); | ||
81 | } | ||
82 | } | ||
52 | 83 | ||
53 | public void LoadDefaultAssets() | 84 | public void LoadDefaultAssets() |
54 | { | 85 | { |
@@ -117,9 +148,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
117 | AssetRequest req = new AssetRequest(); | 148 | AssetRequest req = new AssetRequest(); |
118 | req.AssetID = assetID; | 149 | req.AssetID = assetID; |
119 | req.IsTexture = isTexture; | 150 | req.IsTexture = isTexture; |
120 | MainLog.Instance.Verbose("ASSET","Adding {0} to request queue", assetID); | ||
121 | _assetRequests.Enqueue(req); | 151 | _assetRequests.Enqueue(req); |
122 | MainLog.Instance.Verbose("ASSET","Added {0} to request queue", assetID); | 152 | |
153 | MainLog.Instance.Verbose("ASSET", "Added {0} to request queue", assetID); | ||
123 | } | 154 | } |
124 | 155 | ||
125 | public virtual void UpdateAsset(AssetBase asset) | 156 | public virtual void UpdateAsset(AssetBase asset) |