diff options
author | Justin Clark-Casey (justincc) | 2010-02-02 20:38:58 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-02-02 20:38:58 +0000 |
commit | bbd41de6d5a4aa0301b408be28957b0a15bcc53d (patch) | |
tree | b9366f1ce84950e56faae9c60594595755c07e3b | |
parent | minor: copy some method doc from the WorldComm implementation to the interface (diff) | |
download | opensim-SC-bbd41de6d5a4aa0301b408be28957b0a15bcc53d.zip opensim-SC-bbd41de6d5a4aa0301b408be28957b0a15bcc53d.tar.gz opensim-SC-bbd41de6d5a4aa0301b408be28957b0a15bcc53d.tar.bz2 opensim-SC-bbd41de6d5a4aa0301b408be28957b0a15bcc53d.tar.xz |
refactor: move world comm message queueing into its own method
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 60df2e7..d647e71 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -262,44 +262,34 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
262 | { | 262 | { |
263 | case ChatTypeEnum.Whisper: | 263 | case ChatTypeEnum.Whisper: |
264 | if (dis < m_whisperdistance) | 264 | if (dis < m_whisperdistance) |
265 | { | 265 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
266 | lock (m_pending.SyncRoot) | ||
267 | { | ||
268 | m_pending.Enqueue(new ListenerInfo(li,name,id,msg)); | ||
269 | } | ||
270 | } | ||
271 | break; | 266 | break; |
272 | 267 | ||
273 | case ChatTypeEnum.Say: | 268 | case ChatTypeEnum.Say: |
274 | if (dis < m_saydistance) | 269 | if (dis < m_saydistance) |
275 | { | 270 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
276 | lock (m_pending.SyncRoot) | ||
277 | { | ||
278 | m_pending.Enqueue(new ListenerInfo(li,name,id,msg)); | ||
279 | } | ||
280 | } | ||
281 | break; | 271 | break; |
282 | 272 | ||
283 | case ChatTypeEnum.Shout: | 273 | case ChatTypeEnum.Shout: |
284 | if (dis < m_shoutdistance) | 274 | if (dis < m_shoutdistance) |
285 | { | 275 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
286 | lock (m_pending.SyncRoot) | ||
287 | { | ||
288 | m_pending.Enqueue(new ListenerInfo(li,name,id,msg)); | ||
289 | } | ||
290 | } | ||
291 | break; | 276 | break; |
292 | 277 | ||
293 | case ChatTypeEnum.Region: | 278 | case ChatTypeEnum.Region: |
294 | lock (m_pending.SyncRoot) | 279 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
295 | { | ||
296 | m_pending.Enqueue(new ListenerInfo(li,name,id,msg)); | ||
297 | } | ||
298 | break; | 280 | break; |
299 | } | 281 | } |
300 | } | 282 | } |
301 | } | 283 | } |
302 | 284 | ||
285 | protected void QueueMessage(ListenerInfo li) | ||
286 | { | ||
287 | lock (m_pending.SyncRoot) | ||
288 | { | ||
289 | m_pending.Enqueue(li); | ||
290 | } | ||
291 | } | ||
292 | |||
303 | /// <summary> | 293 | /// <summary> |
304 | /// Are there any listen events ready to be dispatched? | 294 | /// Are there any listen events ready to be dispatched? |
305 | /// </summary> | 295 | /// </summary> |
@@ -319,7 +309,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
319 | 309 | ||
320 | lock (m_pending.SyncRoot) | 310 | lock (m_pending.SyncRoot) |
321 | { | 311 | { |
322 | li = (ListenerInfo) m_pending.Dequeue(); | 312 | li = (ListenerInfo)m_pending.Dequeue(); |
323 | } | 313 | } |
324 | 314 | ||
325 | return li; | 315 | return li; |