diff options
author | Sean Dague | 2007-09-11 08:25:32 +0000 |
---|---|---|
committer | Sean Dague | 2007-09-11 08:25:32 +0000 |
commit | a1e2fea7c1fc612da088914aab7a462c212bc97d (patch) | |
tree | b02e50c4662c66d6bbd6b2fed46dac4bec9f4988 | |
parent | remove autogenerated files (diff) | |
download | opensim-SC_OLD-a1e2fea7c1fc612da088914aab7a462c212bc97d.zip opensim-SC_OLD-a1e2fea7c1fc612da088914aab7a462c212bc97d.tar.gz opensim-SC_OLD-a1e2fea7c1fc612da088914aab7a462c212bc97d.tar.bz2 opensim-SC_OLD-a1e2fea7c1fc612da088914aab7a462c212bc97d.tar.xz |
move the locks closer to the data, sqlite for assets now works like a champ
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 12 | ||||
-rw-r--r-- | OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs | 65 |
2 files changed, 37 insertions, 40 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 8a16f03..2f4c006 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -200,10 +200,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
200 | //Console.WriteLine("new texture to send"); | 200 | //Console.WriteLine("new texture to send"); |
201 | TextureSender sender = new TextureSender(req); | 201 | TextureSender sender = new TextureSender(req); |
202 | //sender.OnComplete += this.TextureSent; | 202 | //sender.OnComplete += this.TextureSent; |
203 | lock (this.SendingTextures) | 203 | this.SendingTextures.Add(req.ImageInfo.FullID, sender); |
204 | { | ||
205 | this.SendingTextures.Add(req.ImageInfo.FullID, sender); | ||
206 | } | ||
207 | this.QueueTextures.Enqueue(sender); | 204 | this.QueueTextures.Enqueue(sender); |
208 | } | 205 | } |
209 | 206 | ||
@@ -263,11 +260,8 @@ namespace OpenSim.Framework.Communications.Caches | |||
263 | { | 260 | { |
264 | if (this.SendingTextures.ContainsKey(sender.request.ImageInfo.FullID)) | 261 | if (this.SendingTextures.ContainsKey(sender.request.ImageInfo.FullID)) |
265 | { | 262 | { |
266 | lock (this.SendingTextures) | 263 | this.SendingTextures.Remove(sender.request.ImageInfo.FullID); |
267 | { | 264 | // this.AvatarRecievedTextures[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID); |
268 | this.SendingTextures.Remove(sender.request.ImageInfo.FullID); | ||
269 | // this.AvatarRecievedTextures[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID); | ||
270 | } | ||
271 | } | 265 | } |
272 | } | 266 | } |
273 | 267 | ||
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs index aef9350..4616275 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs | |||
@@ -61,19 +61,20 @@ namespace OpenSim.Framework.Data.SQLite | |||
61 | 61 | ||
62 | ds = new DataSet(); | 62 | ds = new DataSet(); |
63 | da = new SqliteDataAdapter(new SqliteCommand(assetSelect, conn)); | 63 | da = new SqliteDataAdapter(new SqliteCommand(assetSelect, conn)); |
64 | |||
65 | ds.Tables.Add(createAssetsTable()); | ||
66 | |||
67 | setupAssetCommands(da, conn); | ||
68 | try | ||
69 | { | ||
70 | da.Fill(ds.Tables["assets"]); | ||
71 | } | ||
72 | catch (Exception) | ||
73 | { | ||
74 | MainLog.Instance.Verbose("AssetStorage", "Caught fill error on asset table"); | ||
75 | } | ||
76 | 64 | ||
65 | lock (ds) { | ||
66 | ds.Tables.Add(createAssetsTable()); | ||
67 | |||
68 | setupAssetCommands(da, conn); | ||
69 | try | ||
70 | { | ||
71 | da.Fill(ds.Tables["assets"]); | ||
72 | } | ||
73 | catch (Exception) | ||
74 | { | ||
75 | MainLog.Instance.Verbose("AssetStorage", "Caught fill error on asset table"); | ||
76 | } | ||
77 | } | ||
77 | 78 | ||
78 | return; | 79 | return; |
79 | } | 80 | } |
@@ -110,19 +111,19 @@ namespace OpenSim.Framework.Data.SQLite | |||
110 | ", Local: " + asset.Local + | 111 | ", Local: " + asset.Local + |
111 | ", Data Length: " + asset.Data.Length ); | 112 | ", Data Length: " + asset.Data.Length ); |
112 | DataTable assets = ds.Tables["assets"]; | 113 | DataTable assets = ds.Tables["assets"]; |
113 | DataRow row = assets.Rows.Find(asset.FullID); | 114 | lock(ds) { |
114 | if (row == null) | 115 | DataRow row = assets.Rows.Find(asset.FullID); |
115 | { | 116 | if (row == null) |
116 | row = assets.NewRow(); | 117 | { |
117 | fillAssetRow(row, asset); | 118 | row = assets.NewRow(); |
118 | assets.Rows.Add(row); | 119 | fillAssetRow(row, asset); |
119 | } | 120 | assets.Rows.Add(row); |
120 | else | 121 | } |
121 | { | 122 | else |
122 | fillAssetRow(row, asset); | 123 | { |
124 | fillAssetRow(row, asset); | ||
125 | } | ||
123 | } | 126 | } |
124 | da.Update(ds, "assets"); | ||
125 | ds.AcceptChanges(); | ||
126 | } | 127 | } |
127 | 128 | ||
128 | public bool ExistsAsset(LLUUID uuid) | 129 | public bool ExistsAsset(LLUUID uuid) |
@@ -133,19 +134,21 @@ namespace OpenSim.Framework.Data.SQLite | |||
133 | 134 | ||
134 | public void DeleteAsset(LLUUID uuid) | 135 | public void DeleteAsset(LLUUID uuid) |
135 | { | 136 | { |
136 | DataRow row = ds.Tables["assets"].Rows.Find(uuid); | 137 | lock (ds) { |
137 | if (row != null) { | 138 | DataRow row = ds.Tables["assets"].Rows.Find(uuid); |
138 | row.Delete(); | 139 | if (row != null) { |
140 | row.Delete(); | ||
141 | } | ||
139 | } | 142 | } |
140 | da.Update(ds, "assets"); | ||
141 | ds.AcceptChanges(); | ||
142 | } | 143 | } |
143 | 144 | ||
144 | public void CommitAssets() // force a sync to the database | 145 | public void CommitAssets() // force a sync to the database |
145 | { | 146 | { |
146 | MainLog.Instance.Verbose("AssetStorage", "Attempting commit"); | 147 | MainLog.Instance.Verbose("AssetStorage", "Attempting commit"); |
147 | // da.Update(ds, "assets"); | 148 | lock (ds) { |
148 | // ds.AcceptChanges(); | 149 | da.Update(ds, "assets"); |
150 | ds.AcceptChanges(); | ||
151 | } | ||
149 | } | 152 | } |
150 | 153 | ||
151 | /*********************************************************************** | 154 | /*********************************************************************** |