diff options
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/AssetServer.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetServer.cs | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs index c927571..fa421c7 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs | |||
@@ -25,18 +25,11 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | 28 | using System.IO; |
31 | using System.Threading; | ||
32 | using Db4objects.Db4o; | 29 | using Db4objects.Db4o; |
33 | using Db4objects.Db4o.Query; | 30 | using Db4objects.Db4o.Query; |
34 | using libsecondlife; | 31 | using libsecondlife; |
35 | using Nini.Config; | ||
36 | using OpenSim.Framework.Communications.Cache; | ||
37 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
38 | using OpenSim.Framework.Interfaces; | ||
39 | using OpenSim.Framework; | ||
40 | 33 | ||
41 | namespace OpenSim.Framework.Communications.Cache | 34 | namespace OpenSim.Framework.Communications.Cache |
42 | { | 35 | { |
@@ -50,7 +43,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
50 | yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); | 43 | yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); |
51 | 44 | ||
52 | db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); | 45 | db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); |
53 | MainLog.Instance.Verbose("ASSETS","Db4 Asset database creation"); | 46 | MainLog.Instance.Verbose("ASSETS", "Db4 Asset database creation"); |
54 | 47 | ||
55 | if (!yapfile) | 48 | if (!yapfile) |
56 | { | 49 | { |
@@ -68,29 +61,29 @@ namespace OpenSim.Framework.Communications.Cache | |||
68 | db.Commit(); | 61 | db.Commit(); |
69 | } | 62 | } |
70 | 63 | ||
71 | override public void Close() | 64 | public override void Close() |
72 | { | 65 | { |
73 | base.Close(); | 66 | base.Close(); |
74 | 67 | ||
75 | if (db != null) | 68 | if (db != null) |
76 | { | 69 | { |
77 | MainLog.Instance.Verbose("ASSETSERVER","Closing local asset server database"); | 70 | MainLog.Instance.Verbose("ASSETSERVER", "Closing local asset server database"); |
78 | db.Close(); | 71 | db.Close(); |
79 | } | 72 | } |
80 | } | 73 | } |
81 | 74 | ||
82 | override protected void RunRequests() | 75 | protected override void RunRequests() |
83 | { | 76 | { |
84 | while (true) | 77 | while (true) |
85 | { | 78 | { |
86 | byte[] idata = null; | 79 | byte[] idata = null; |
87 | bool found = false; | 80 | bool found = false; |
88 | AssetStorage foundAsset = null; | 81 | AssetStorage foundAsset = null; |
89 | ARequest req = this._assetRequests.Dequeue(); | 82 | ARequest req = _assetRequests.Dequeue(); |
90 | IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); | 83 | IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); |
91 | if (result.Count > 0) | 84 | if (result.Count > 0) |
92 | { | 85 | { |
93 | foundAsset = (AssetStorage)result.Next(); | 86 | foundAsset = (AssetStorage) result.Next(); |
94 | found = true; | 87 | found = true; |
95 | } | 88 | } |
96 | 89 | ||
@@ -110,12 +103,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
110 | //asset.FullID = ; | 103 | //asset.FullID = ; |
111 | _receiver.AssetNotFound(req.AssetID); | 104 | _receiver.AssetNotFound(req.AssetID); |
112 | } | 105 | } |
113 | |||
114 | } | 106 | } |
115 | |||
116 | } | 107 | } |
117 | 108 | ||
118 | override protected void StoreAsset(AssetBase asset) | 109 | protected override void StoreAsset(AssetBase asset) |
119 | { | 110 | { |
120 | AssetStorage store = new AssetStorage(); | 111 | AssetStorage store = new AssetStorage(); |
121 | store.Data = asset.Data; | 112 | store.Data = asset.Data; |
@@ -148,6 +139,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
148 | { | 139 | { |
149 | _findID = find; | 140 | _findID = find; |
150 | } | 141 | } |
142 | |||
151 | public bool Match(AssetStorage asset) | 143 | public bool Match(AssetStorage asset) |
152 | { | 144 | { |
153 | return (asset.UUID == _findID); | 145 | return (asset.UUID == _findID); |