diff options
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 2e36123..f57d485 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -141,6 +141,14 @@ namespace OpenSim.Data.MySQL | |||
141 | Migration m = new Migration(m_connection, assem, "RegionStore"); | 141 | Migration m = new Migration(m_connection, assem, "RegionStore"); |
142 | m.Update(); | 142 | m.Update(); |
143 | 143 | ||
144 | PrepareConnection(); | ||
145 | } | ||
146 | |||
147 | public void Dispose() {} | ||
148 | |||
149 | private void PrepareConnection() | ||
150 | { | ||
151 | GetWaitTimeout(); | ||
144 | 152 | ||
145 | MySqlCommand primSelectCmd = new MySqlCommand(m_primSelect, m_connection); | 153 | MySqlCommand primSelectCmd = new MySqlCommand(m_primSelect, m_connection); |
146 | m_primDataAdapter = new MySqlDataAdapter(primSelectCmd); | 154 | m_primDataAdapter = new MySqlDataAdapter(primSelectCmd); |
@@ -203,8 +211,6 @@ namespace OpenSim.Data.MySQL | |||
203 | } | 211 | } |
204 | } | 212 | } |
205 | 213 | ||
206 | public void Dispose() {} | ||
207 | |||
208 | /// <summary> | 214 | /// <summary> |
209 | /// Get the wait_timeout value for our connection | 215 | /// Get the wait_timeout value for our connection |
210 | /// </summary> | 216 | /// </summary> |
@@ -254,6 +260,8 @@ namespace OpenSim.Data.MySQL | |||
254 | m_connection.Close(); | 260 | m_connection.Close(); |
255 | m_connection = new MySqlConnection(m_connectionString); | 261 | m_connection = new MySqlConnection(m_connectionString); |
256 | m_connection.Open(); | 262 | m_connection.Open(); |
263 | |||
264 | PrepareConnection(); | ||
257 | } | 265 | } |
258 | } | 266 | } |
259 | 267 | ||
@@ -308,22 +316,40 @@ namespace OpenSim.Data.MySQL | |||
308 | /// <param name="regionUUID">The region UUID</param> | 316 | /// <param name="regionUUID">The region UUID</param> |
309 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 317 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
310 | { | 318 | { |
311 | lock (m_dataSet) | 319 | int tries = 3; |
320 | while (tries > 0) | ||
312 | { | 321 | { |
313 | foreach (SceneObjectPart prim in obj.Children.Values) | 322 | tries--; |
323 | |||
324 | try | ||
314 | { | 325 | { |
315 | if ((prim.GetEffectiveObjectFlags() & (uint)PrimFlags.Temporary) == 0 | 326 | lock (m_dataSet) |
316 | && (prim.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) == 0) | ||
317 | { | ||
318 | //m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); | ||
319 | addPrim(prim, obj.UUID, regionUUID); | ||
320 | } | ||
321 | else | ||
322 | { | 327 | { |
323 | // m_log.Info("[DATASTORE]: Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); | 328 | foreach (SceneObjectPart prim in obj.Children.Values) |
329 | { | ||
330 | if ((prim.GetEffectiveObjectFlags() & (uint)PrimFlags.Temporary) == 0 | ||
331 | && (prim.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) == 0) | ||
332 | { | ||
333 | //m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); | ||
334 | addPrim(prim, obj.UUID, regionUUID); | ||
335 | } | ||
336 | else | ||
337 | { | ||
338 | // m_log.Info("[DATASTORE]: Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); | ||
339 | } | ||
340 | } | ||
341 | Commit(); | ||
342 | return; | ||
324 | } | 343 | } |
325 | } | 344 | } |
326 | Commit(); | 345 | catch(MySqlException) |
346 | { | ||
347 | m_connection.Close(); | ||
348 | m_connection = new MySqlConnection(m_connectionString); | ||
349 | m_connection.Open(); | ||
350 | |||
351 | PrepareConnection(); | ||
352 | } | ||
327 | } | 353 | } |
328 | } | 354 | } |
329 | 355 | ||