refactor: move world comm message queueing into its own method

mysql-performance
Justin Clark-Casey (justincc) 2010-02-02 20:38:58 +00:00
parent 0faeaf98a6
commit bbd41de6d5
1 changed files with 13 additions and 23 deletions

View File

@ -262,44 +262,34 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
{
case ChatTypeEnum.Whisper:
if (dis < m_whisperdistance)
{
lock (m_pending.SyncRoot)
{
m_pending.Enqueue(new ListenerInfo(li,name,id,msg));
}
}
QueueMessage(new ListenerInfo(li, name, id, msg));
break;
case ChatTypeEnum.Say:
if (dis < m_saydistance)
{
lock (m_pending.SyncRoot)
{
m_pending.Enqueue(new ListenerInfo(li,name,id,msg));
}
}
QueueMessage(new ListenerInfo(li, name, id, msg));
break;
case ChatTypeEnum.Shout:
if (dis < m_shoutdistance)
{
lock (m_pending.SyncRoot)
{
m_pending.Enqueue(new ListenerInfo(li,name,id,msg));
}
}
QueueMessage(new ListenerInfo(li, name, id, msg));
break;
case ChatTypeEnum.Region:
lock (m_pending.SyncRoot)
{
m_pending.Enqueue(new ListenerInfo(li,name,id,msg));
}
QueueMessage(new ListenerInfo(li, name, id, msg));
break;
}
}
}
protected void QueueMessage(ListenerInfo li)
{
lock (m_pending.SyncRoot)
{
m_pending.Enqueue(li);
}
}
/// <summary>
/// Are there any listen events ready to be dispatched?
/// </summary>
@ -319,7 +309,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
lock (m_pending.SyncRoot)
{
li = (ListenerInfo) m_pending.Dequeue();
li = (ListenerInfo)m_pending.Dequeue();
}
return li;