aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/WorldCommModule.cs
diff options
context:
space:
mode:
authorSean Dague2008-02-19 19:16:21 +0000
committerSean Dague2008-02-19 19:16:21 +0000
commit530cc2488461a4ef68a06eaba42698fcdc09f459 (patch)
treed2db34a2dcdb10b3b85aaeb200334ee9a27cae91 /OpenSim/Region/Environment/Modules/WorldCommModule.cs
parentAdded to OpenSim.ini.example: (diff)
downloadopensim-SC-530cc2488461a4ef68a06eaba42698fcdc09f459.zip
opensim-SC-530cc2488461a4ef68a06eaba42698fcdc09f459.tar.gz
opensim-SC-530cc2488461a4ef68a06eaba42698fcdc09f459.tar.bz2
opensim-SC-530cc2488461a4ef68a06eaba42698fcdc09f459.tar.xz
From: Michael Osias <mosias@us.ibm.com>
This patch implements the llSendRemoteData command and fixes mantis 552, and possibly 586.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/WorldCommModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/WorldCommModule.cs72
1 files changed, 52 insertions, 20 deletions
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
index a426eda..b6d4e3d 100644
--- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
@@ -84,8 +84,8 @@ namespace OpenSim.Region.Environment.Modules
84 m_scene = scene; 84 m_scene = scene;
85 m_scene.RegisterModuleInterface<IWorldComm>(this); 85 m_scene.RegisterModuleInterface<IWorldComm>(this);
86 m_listenerManager = new ListenerManager(); 86 m_listenerManager = new ListenerManager();
87 m_pending = new Queue<ListenerInfo>();
88 m_scene.EventManager.OnNewClient += NewClient; 87 m_scene.EventManager.OnNewClient += NewClient;
88 m_pending = new Queue<ListenerInfo>();
89 } 89 }
90 90
91 public void PostInitialise() 91 public void PostInitialise()
@@ -139,9 +139,12 @@ namespace OpenSim.Region.Environment.Modules
139 139
140 public void DeleteListener(LLUUID itemID) 140 public void DeleteListener(LLUUID itemID)
141 { 141 {
142 lock (ListLock) 142 if (m_listenerManager != null)
143 { 143 {
144 m_listenerManager.DeleteListener(itemID); 144 lock (ListLock)
145 {
146 m_listenerManager.DeleteListener(itemID);
147 }
145 } 148 }
146 149
147 } 150 }
@@ -167,14 +170,14 @@ namespace OpenSim.Region.Environment.Modules
167 // If they are in proximity, then if they are 170 // If they are in proximity, then if they are
168 // listeners, if so add them to the pending queue 171 // listeners, if so add them to the pending queue
169 172
170 foreach (LLUUID eb in m_scene.Entities.Keys) 173 foreach (ListenerInfo li in m_listenerManager.GetListeners())
171 { 174 {
172 EntityBase sPart; 175 EntityBase sPart;
173 176
174 m_scene.Entities.TryGetValue(eb, out sPart); 177 m_scene.Entities.TryGetValue(li.GetHostID(), out sPart);
175 178
176 // Dont process if this message is from itself! 179 // Dont process if this message is from itself!
177 if (eb.ToString().Equals(sourceItemID) || 180 if (li.GetHostID().ToString().Equals(sourceItemID) ||
178 sPart.UUID.ToString().Equals(sourceItemID)) 181 sPart.UUID.ToString().Equals(sourceItemID))
179 continue; 182 continue;
180 183
@@ -196,7 +199,10 @@ namespace OpenSim.Region.Environment.Modules
196 ); 199 );
197 if (isListener != null) 200 if (isListener != null)
198 { 201 {
199 m_pending.Enqueue(isListener); 202 lock (CommListLock)
203 {
204 m_pending.Enqueue(isListener);
205 }
200 } 206 }
201 } 207 }
202 break; 208 break;
@@ -210,7 +216,10 @@ namespace OpenSim.Region.Environment.Modules
210 ); 216 );
211 if (isListener != null) 217 if (isListener != null)
212 { 218 {
213 m_pending.Enqueue(isListener); 219 lock (CommListLock)
220 {
221 m_pending.Enqueue(isListener);
222 }
214 } 223 }
215 } 224 }
216 break; 225 break;
@@ -223,14 +232,17 @@ namespace OpenSim.Region.Environment.Modules
223 ); 232 );
224 if (isListener != null) 233 if (isListener != null)
225 { 234 {
226 m_pending.Enqueue(isListener); 235 lock (CommListLock)
236 {
237 m_pending.Enqueue(isListener);
238 }
227 } 239 }
228 } 240 }
229 break; 241 break;
230 242
231 case ChatTypeEnum.Broadcast: 243 case ChatTypeEnum.Broadcast:
232 ListenerInfo isListen = 244 ListenerInfo isListen =
233 m_listenerManager.IsListenerMatch(sourceItemID, eb, channel, name, msg); 245 m_listenerManager.IsListenerMatch(sourceItemID, li.GetItemID(), channel, name, msg);
234 if (isListen != null) 246 if (isListen != null)
235 { 247 {
236 ListenerInfo isListener = m_listenerManager.IsListenerMatch( 248 ListenerInfo isListener = m_listenerManager.IsListenerMatch(
@@ -238,19 +250,24 @@ namespace OpenSim.Region.Environment.Modules
238 ); 250 );
239 if (isListener != null) 251 if (isListener != null)
240 { 252 {
241 m_pending.Enqueue(isListener); 253 lock (CommListLock)
254 {
255 m_pending.Enqueue(isListener);
256 }
242 } 257 }
243 } 258 }
244 break; 259 break;
245 } 260 }
246 } 261 }
247 ;
248 } 262 }
249 } 263 }
250 264
251 public bool HasMessages() 265 public bool HasMessages()
252 { 266 {
253 return (m_pending.Count > 0); 267 if (m_pending != null)
268 return (m_pending.Count > 0);
269 else
270 return false;
254 } 271 }
255 272
256 public ListenerInfo GetNextMessage() 273 public ListenerInfo GetNextMessage()
@@ -264,6 +281,17 @@ namespace OpenSim.Region.Environment.Modules
264 281
265 return li; 282 return li;
266 } 283 }
284
285 public uint PeekNextMessageLocalID()
286 {
287 return m_pending.Peek().GetLocalID();
288 }
289
290 public LLUUID PeekNextMessageItemID()
291 {
292 return m_pending.Peek().GetItemID();
293 }
294
267 } 295 }
268 296
269 // hostID: the ID of the ScenePart 297 // hostID: the ID of the ScenePart
@@ -280,8 +308,7 @@ namespace OpenSim.Region.Environment.Modules
280 m_listeners = new Dictionary<int, ListenerInfo>(); 308 m_listeners = new Dictionary<int, ListenerInfo>();
281 } 309 }
282 310
283 public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, 311 public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg)
284 string msg)
285 { 312 {
286 if (m_listeners.Count < m_MaxListeners) 313 if (m_listeners.Count < m_MaxListeners)
287 { 314 {
@@ -410,6 +437,11 @@ namespace OpenSim.Region.Environment.Modules
410 } 437 }
411 return null; 438 return null;
412 } 439 }
440
441 public Dictionary<int, ListenerInfo>.ValueCollection GetListeners()
442 {
443 return m_listeners.Values;
444 }
413 } 445 }
414 446
415 public class ListenerInfo 447 public class ListenerInfo
@@ -425,21 +457,20 @@ namespace OpenSim.Region.Environment.Modules
425 private string m_message; // The message 457 private string m_message; // The message
426 private bool m_active; // Listener is active or not 458 private bool m_active; // Listener is active or not
427 459
428 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, 460 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message)
429 string message)
430 { 461 {
431 Initialise(localID, handle, ItemID, hostID, channel, name, id, message); 462 Initialise(localID, handle, ItemID, hostID, channel, name, id, message);
432 } 463 }
433 464
434 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, 465 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id,
435 string message, LLUUID sourceItemID) 466 string message, LLUUID sourceItemID)
436 { 467 {
437 Initialise(localID, handle, ItemID, hostID, channel, name, id, message); 468 Initialise(localID, handle, ItemID, hostID, channel, name, id, message);
438 m_sourceItemID = sourceItemID; 469 m_sourceItemID = sourceItemID;
439 } 470 }
440 471
441 private void Initialise(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, 472 private void Initialise(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name,
442 LLUUID id, string message) 473 LLUUID id, string message)
443 { 474 {
444 m_handle = handle; 475 m_handle = handle;
445 m_channel = channel; 476 m_channel = channel;
@@ -511,5 +542,6 @@ namespace OpenSim.Region.Environment.Modules
511 { 542 {
512 return m_id; 543 return m_id;
513 } 544 }
545
514 } 546 }
515} \ No newline at end of file 547}