Added some if condition in RegionSyncModule.SendSceneUpdates, so that if no updates to send, no thread is assigned to send updates.

dsg
Huaiyu (Kitty) Liu 2011-01-26 17:17:03 -08:00
parent 441551e7c6
commit 85b7bb916f
1 changed files with 78 additions and 68 deletions

View File

@ -239,6 +239,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
}
if (primUpdates != null || presenceUpdates != null)
{
// This could be another thread for sending outgoing messages or just have the Queue functions
// create and queue the messages directly into the outgoing server thread.
System.Threading.ThreadPool.QueueUserWorkItem(delegate
@ -310,6 +312,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
Interlocked.Exchange(ref m_sendingUpdates, 0);
});
}
else
{
Interlocked.Exchange(ref m_sendingUpdates, 0);
}
}
//The following Sendxxx calls,send out a message immediately, w/o putting it in the SyncConnector's outgoing queue.
//May need some optimization there on the priorities.
@ -985,7 +992,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_scene.RequestModuleInterface<ITerrainModule>().TaintTerrain();
m_log.Debug(LogHeader+": Synchronized terrain");
* */
HandleTerrainUpdateMessage(msg);
HandleTerrainUpdateMessage(msg, senderActorID);
return;
}
case SymmetricSyncMessage.MsgType.GetObjects:
@ -1006,18 +1013,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
case SymmetricSyncMessage.MsgType.NewObject:
case SymmetricSyncMessage.MsgType.UpdatedObject:
{
HandleAddOrUpdateObjectBySynchronization(msg);
HandleAddOrUpdateObjectBySynchronization(msg, senderActorID);
//HandleAddNewObject(sog);
return;
}
case SymmetricSyncMessage.MsgType.RemovedObject:
{
HandleRemovedObject(msg);
HandleRemovedObject(msg, senderActorID);
return;
}
case SymmetricSyncMessage.MsgType.LinkObject:
{
HandleLinkObject(msg);
HandleLinkObject(msg, senderActorID);
return;
}
//EVENTS PROCESSING
@ -1030,7 +1037,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
case SymmetricSyncMessage.MsgType.ObjectGrabbing:
case SymmetricSyncMessage.MsgType.ObjectDeGrab:
{
HandleRemoteEvent(msg);
HandleRemoteEvent(msg, senderActorID);
return;
}
default:
@ -1038,7 +1045,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
}
private void HandleTerrainUpdateMessage(SymmetricSyncMessage msg)
private void HandleTerrainUpdateMessage(SymmetricSyncMessage msg, string senderActorID)
{
// Get the data from message and error check
OSDMap data = DeserializeMessage(msg);
@ -1059,7 +1066,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_log.Debug(LogHeader + ": Synchronized terrain");
}
private void HandleAddOrUpdateObjectBySynchronization(SymmetricSyncMessage msg)
private void HandleAddOrUpdateObjectBySynchronization(SymmetricSyncMessage msg, string senderActorID)
{
string sogxml = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml);
@ -1140,7 +1147,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
}
private void HandleRemovedObject(SymmetricSyncMessage msg)
private void HandleRemovedObject(SymmetricSyncMessage msg, string senderActorID)
{
// Get the data from message and error check
OSDMap data = DeserializeMessage(msg);
@ -1175,11 +1182,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//if this is a relay node, forwards the event
if (m_isSyncRelay)
{
SendSceneEventToRelevantSyncConnectors(init_actorID, msg);
//SendSceneEventToRelevantSyncConnectors(init_actorID, msg);
SendSceneEventToRelevantSyncConnectors(senderActorID, msg);
}
}
private void HandleLinkObject(SymmetricSyncMessage msg)
private void HandleLinkObject(SymmetricSyncMessage msg, string senderActorID)
{
// Get the data from message and error check
OSDMap data = DeserializeMessage(msg);
@ -1207,7 +1215,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//if this is a relay node, forwards the event
if (m_isSyncRelay)
{
SendSceneEventToRelevantSyncConnectors(init_actorID, msg);
//SendSceneEventToRelevantSyncConnectors(init_actorID, msg);
SendSceneEventToRelevantSyncConnectors(senderActorID, msg);
}
}
@ -1215,7 +1224,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
/// The common actions for handling remote events (event initiated at other actors and propogated here)
/// </summary>
/// <param name="msg"></param>
private void HandleRemoteEvent(SymmetricSyncMessage msg)
private void HandleRemoteEvent(SymmetricSyncMessage msg, string senderActorID)
{
OSDMap data = DeserializeMessage(msg);
string init_actorID = data["actorID"].AsString();
@ -1252,7 +1261,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//if this is a relay node, forwards the event
if (m_isSyncRelay)
{
SendSceneEventToRelevantSyncConnectors(init_actorID, msg);
//SendSceneEventToRelevantSyncConnectors(init_actorID, msg);
SendSceneEventToRelevantSyncConnectors(senderActorID, msg);
}
}