* Stop an exception in the Content Management module main loop from crashing the whole sim

0.6.0-stable
Justin Clarke Casey 2008-11-04 21:30:57 +00:00
parent 09dabb2aec
commit 8851db0a0a
1 changed files with 44 additions and 34 deletions

View File

@ -162,44 +162,54 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
/// </summary> /// </summary>
private void MainLoop() private void MainLoop()
{ {
CMModel model = m_model; CMView view = m_view; int channel = m_channel; try
Work currentJob = new Work();
while (true)
{ {
currentJob = m_WorkQueue.Dequeue(); CMModel model = m_model; CMView view = m_view; int channel = m_channel;
m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- DeQueued a request"); Work currentJob = new Work();
m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- Work type: " + currentJob.Type); while (true)
switch (currentJob.Type)
{ {
case WorkType.NONE: currentJob = m_WorkQueue.Dequeue();
break; m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- DeQueued a request");
case WorkType.OBJECTATTRIBUTECHANGE: m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- Work type: " + currentJob.Type);
ObjectAttributeChanged(model, view, currentJob.LocalId); switch (currentJob.Type)
break; {
case WorkType.PRIMITIVEADDED: case WorkType.NONE:
PrimitiveAdded(model, view, currentJob); break;
break; case WorkType.OBJECTATTRIBUTECHANGE:
case WorkType.OBJECTDUPLICATED: ObjectAttributeChanged(model, view, currentJob.LocalId);
ObjectDuplicated(model, view, currentJob.LocalId); break;
break; case WorkType.PRIMITIVEADDED:
case WorkType.OBJECTKILLED: PrimitiveAdded(model, view, currentJob);
ObjectKilled(model, view, (SceneObjectGroup) currentJob.Data1); break;
break; case WorkType.OBJECTDUPLICATED:
case WorkType.UNDODID: ObjectDuplicated(model, view, currentJob.LocalId);
UndoDid(model, view, currentJob.UUID); break;
break; case WorkType.OBJECTKILLED:
case WorkType.NEWCLIENT: ObjectKilled(model, view, (SceneObjectGroup) currentJob.Data1);
NewClient(view, (IClientAPI) currentJob.Data1); break;
break; case WorkType.UNDODID:
case WorkType.SIMCHAT: UndoDid(model, view, currentJob.UUID);
m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- Message received: " + ((OSChatMessage) currentJob.Data1).Message); break;
SimChat(model, view, (OSChatMessage) currentJob.Data1, channel); case WorkType.NEWCLIENT:
break; NewClient(view, (IClientAPI) currentJob.Data1);
default: break;
m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- uuuuuuuuuh, what?"); case WorkType.SIMCHAT:
break; m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- Message received: " + ((OSChatMessage) currentJob.Data1).Message);
SimChat(model, view, (OSChatMessage) currentJob.Data1, channel);
break;
default:
m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- uuuuuuuuuh, what?");
break;
}
} }
} }
catch (Exception e)
{
// TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened
m_log.ErrorFormat(
"[CONTENT MANAGEMENT]: Content management thread terminating with exception. PLEASE REBOOT YOUR SIM - CONTENT MANAGEMENT WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}",
e);
}
} }
/// <summary> /// <summary>