aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-09-29 19:55:45 +0000
committerJustin Clarke Casey2008-09-29 19:55:45 +0000
commit374947cf01c0ba70f1a56e0030eb7d28c088f5e1 (patch)
treee0a34c1a3c1814f97aa1968c555c4bdb19905b1b /OpenSim/Region
parent* minor: remove warning (diff)
downloadopensim-SC_OLD-374947cf01c0ba70f1a56e0030eb7d28c088f5e1.zip
opensim-SC_OLD-374947cf01c0ba70f1a56e0030eb7d28c088f5e1.tar.gz
opensim-SC_OLD-374947cf01c0ba70f1a56e0030eb7d28c088f5e1.tar.bz2
opensim-SC_OLD-374947cf01c0ba70f1a56e0030eb7d28c088f5e1.tar.xz
* minor: tidy up async sog deleter
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs37
1 files changed, 18 insertions, 19 deletions
diff --git a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs
index 8c43bcb..78f29de 100644
--- a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Timers; 31using System.Timers;
32using System.Threading;
32using log4net; 33using log4net;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenMetaverse.Packets; 35using OpenMetaverse.Packets;
@@ -55,13 +56,16 @@ namespace OpenSim.Region.Environment.Scenes
55 private static readonly ILog m_log 56 private static readonly ILog m_log
56 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 57 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
57 58
58 private Timer m_inventoryTicker; 59 private System.Timers.Timer m_inventoryTicker = new System.Timers.Timer(2000);
59 private readonly Queue<DeleteToInventoryHolder> m_inventoryDeletes = new Queue<DeleteToInventoryHolder>(); 60 private readonly Queue<DeleteToInventoryHolder> m_inventoryDeletes = new Queue<DeleteToInventoryHolder>();
60 private Scene m_scene; 61 private Scene m_scene;
61 62
62 public AsyncSceneObjectGroupDeleter(Scene scene) 63 public AsyncSceneObjectGroupDeleter(Scene scene)
63 { 64 {
64 m_scene = scene; 65 m_scene = scene;
66
67 m_inventoryTicker.AutoReset = false;
68 m_inventoryTicker.Elapsed += InventoryRunDeleteTimer;
65 } 69 }
66 70
67 /// <summary> 71 /// <summary>
@@ -71,16 +75,7 @@ namespace OpenSim.Region.Environment.Scenes
71 DeRezObjectPacket DeRezPacket, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient, 75 DeRezObjectPacket DeRezPacket, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient,
72 EntityBase selectedEnt, bool permissionToDelete) 76 EntityBase selectedEnt, bool permissionToDelete)
73 { 77 {
74 if (m_inventoryTicker != null) 78 m_inventoryTicker.Stop();
75 {
76 m_inventoryTicker.Stop();
77 }
78 else
79 {
80 m_inventoryTicker = new Timer(2000);
81 m_inventoryTicker.AutoReset = false;
82 m_inventoryTicker.Elapsed += InventoryRunDeleteTimer;
83 }
84 79
85 lock (m_inventoryDeletes) 80 lock (m_inventoryDeletes)
86 { 81 {
@@ -104,17 +99,18 @@ namespace OpenSim.Region.Environment.Scenes
104 99
105 private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) 100 private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e)
106 { 101 {
107 m_log.Info("Starting inventory send loop"); 102 m_log.Debug("[SCENE]: Starting send to inventory loop");
108 while (InventoryDeQueueAndDelete() == true) 103
104 while (InventoryDeQueueAndDelete())
109 { 105 {
110 m_log.Info("Returned item successfully, continuing..."); 106 m_log.Debug("[SCENE]: Returned item successfully to inventory, continuing...");
111 } 107 }
112 } 108 }
113 109
114 private bool InventoryDeQueueAndDelete() 110 private bool InventoryDeQueueAndDelete()
115 { 111 {
116 DeleteToInventoryHolder x = null; 112 DeleteToInventoryHolder x = null;
117 113
118 try 114 try
119 { 115 {
120 lock (m_inventoryDeletes) 116 lock (m_inventoryDeletes)
@@ -122,10 +118,13 @@ namespace OpenSim.Region.Environment.Scenes
122 int left = m_inventoryDeletes.Count; 118 int left = m_inventoryDeletes.Count;
123 if (left > 0) 119 if (left > 0)
124 { 120 {
125 m_log.InfoFormat("Sending deleted object to user's inventory, {0} item(s) remaining.", left); 121 m_log.DebugFormat(
122 "[SCENE]: Sending deleted object to user's inventory, {0} item(s) remaining.", left);
123
126 x = m_inventoryDeletes.Dequeue(); 124 x = m_inventoryDeletes.Dequeue();
127 m_scene.DeleteToInventory( 125 m_scene.DeleteToInventory(
128 x.DeRezPacket, x.selectedEnt, x.remoteClient, x.objectGroup, x.folderID, x.permissionToDelete); 126 x.DeRezPacket, x.selectedEnt, x.remoteClient, x.objectGroup, x.folderID, x.permissionToDelete);
127
129 return true; 128 return true;
130 } 129 }
131 } 130 }
@@ -135,11 +134,11 @@ namespace OpenSim.Region.Environment.Scenes
135 // We can't put the object group details in here since the root part may have disappeared (which is where these sit). 134 // We can't put the object group details in here since the root part may have disappeared (which is where these sit).
136 // FIXME: This needs to be fixed. 135 // FIXME: This needs to be fixed.
137 m_log.ErrorFormat( 136 m_log.ErrorFormat(
138 "[AGENT INVENTORY]: Queued deletion of scene object to agent {0} {1} failed: {2}", 137 "[SCENE]: Queued deletion of scene object to agent {0} {1} failed: {2}",
139 (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString()); 138 (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString());
140 } 139 }
141 140
142 m_log.Info("No objects left in inventory delete queue."); 141 m_log.Debug("[SCENE]: No objects left in inventory delete queue.");
143 return false; 142 return false;
144 } 143 }
145 } 144 }