aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs49
1 files changed, 44 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs
index f1f70ff..436231b 100644
--- a/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs
@@ -136,7 +136,12 @@ namespace OpenSim.Region.Environment.Modules.Framework
136 } 136 }
137 #endregion 137 #endregion
138 138
139 private BlockingLLSDQueue GetQueue(UUID agentId) 139 /// <summary>
140 /// Always returns a valid queue
141 /// </summary>
142 /// <param name="agentId"></param>
143 /// <returns></returns>
144 private BlockingLLSDQueue TryGetQueue(UUID agentId)
140 { 145 {
141 lock (queues) 146 lock (queues)
142 { 147 {
@@ -150,15 +155,34 @@ namespace OpenSim.Region.Environment.Modules.Framework
150 } 155 }
151 } 156 }
152 157
153 158 /// <summary>
159 /// May return a null queue
160 /// </summary>
161 /// <param name="agentId"></param>
162 /// <returns></returns>
163 private BlockingLLSDQueue GetQueue(UUID agentId)
164 {
165 lock (queues)
166 {
167 if (queues.ContainsKey(agentId))
168 {
169 return queues[agentId];
170 }
171 else
172 return null;
173 }
174 }
175
154 #region IEventQueue Members 176 #region IEventQueue Members
177
155 public bool Enqueue(OSD ev, UUID avatarID) 178 public bool Enqueue(OSD ev, UUID avatarID)
156 { 179 {
157 m_log.DebugFormat("[EVENTQUEUE]: Enqueuing event for {0} in region {1}", avatarID, m_scene.RegionInfo.RegionName); 180 m_log.DebugFormat("[EVENTQUEUE]: Enqueuing event for {0} in region {1}", avatarID, m_scene.RegionInfo.RegionName);
158 try 181 try
159 { 182 {
160 BlockingLLSDQueue queue = GetQueue(avatarID); 183 BlockingLLSDQueue queue = GetQueue(avatarID);
161 queue.Enqueue(ev); 184 if (queue != null)
185 queue.Enqueue(ev);
162 } catch(NullReferenceException e) 186 } catch(NullReferenceException e)
163 { 187 {
164 m_log.Debug("[EVENTQUEUE] Caught exception: " + e); 188 m_log.Debug("[EVENTQUEUE] Caught exception: " + e);
@@ -166,11 +190,26 @@ namespace OpenSim.Region.Environment.Modules.Framework
166 } 190 }
167 return true; 191 return true;
168 } 192 }
193
169 #endregion 194 #endregion
170 195
171 private void OnNewClient(IClientAPI client) 196 private void OnNewClient(IClientAPI client)
172 { 197 {
173 m_log.DebugFormat("[EVENTQUEUE]: New client {0} detected in region {1}", client.AgentId, m_scene.RegionInfo.RegionName); 198 //m_log.DebugFormat("[EVENTQUEUE]: New client {0} detected in region {1}", client.AgentId, m_scene.RegionInfo.RegionName);
199 //lock (queues)
200 //{
201 // if (queues.ContainsKey(client.AgentId))
202 // {
203 // m_log.DebugFormat("[EVENTQUEUE]: Removing old queue for agent {0} in region {1}", client.AgentId,
204 // m_scene.RegionInfo.RegionName);
205 // queues.Remove(client.AgentId);
206 // }
207
208 // m_log.DebugFormat("[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", client.AgentId,
209 // m_scene.RegionInfo.RegionName);
210 // queues[client.AgentId] = new BlockingLLSDQueue();
211 //}
212
174 client.OnLogout += ClientClosed; 213 client.OnLogout += ClientClosed;
175 } 214 }
176 215
@@ -317,7 +356,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
317// m_log.DebugFormat(debug + " ]", agentID, m_scene.RegionInfo.RegionName, System.Threading.Thread.CurrentThread.Name); 356// m_log.DebugFormat(debug + " ]", agentID, m_scene.RegionInfo.RegionName, System.Threading.Thread.CurrentThread.Name);
318// } 357// }
319 358
320 BlockingLLSDQueue queue = GetQueue(agentID); 359 BlockingLLSDQueue queue = TryGetQueue(agentID);
321 OSD element = queue.Dequeue(15000); // 15s timeout 360 OSD element = queue.Dequeue(15000); // 15s timeout
322 361
323 Hashtable responsedata = new Hashtable(); 362 Hashtable responsedata = new Hashtable();