Fixed a region split synchronization bug

0.6.0-stable
Johan Berntsson 2008-03-04 09:39:58 +00:00
parent fe56c18795
commit c78eebfdfc
2 changed files with 35 additions and 30 deletions

View File

@ -158,6 +158,17 @@ namespace OpenSim.Framework
return circuits.ToArray(); return circuits.ToArray();
} }
public List<uint> GetAllCircuitCodes()
{
List<uint> circuits;
lock (m_clients)
{
circuits = new List<uint>(m_clients.Keys);
}
return circuits;
}
public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock)
{ {

View File

@ -525,21 +525,6 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
udpserv = SearchUDPServerFromPortNum(scene.RegionInfo.InternalEndPoint.Port); udpserv = SearchUDPServerFromPortNum(scene.RegionInfo.InternalEndPoint.Port);
// restore the scene presence // restore the scene presence
/*
files = Directory.GetFiles(import_dir, "Presence_*.bin");
Array.Sort(files);
foreach (string filename in files)
{
sp = (ScenePresence)Util.DeserializeFromFile(filename);
Console.WriteLine("agent id = {0}", sp.m_uuid);
scene.m_restorePresences.Add(sp.m_uuid, sp);
File.Delete(filename);
m_log.InfoFormat("[BALANCER] "+"scene presence deserialized [{0}]", sp.m_uuid);
}
*/
for (int i = 0; ; i++) for (int i = 0; ; i++)
{ {
string filename = import_dir + "Presence_" + String.Format("{0:0000}", i) + ".bin"; string filename = import_dir + "Presence_" + String.Format("{0:0000}", i) + ".bin";
@ -746,24 +731,33 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
// Disabling half of the avatars in master, and the other half in slave // Disabling half of the avatars in master, and the other half in slave
int i = 0; int i = 0;
List<ScenePresence> presences = scene.GetScenePresences();
presences.Sort();
foreach (ScenePresence pre in presences)
{
// Divide the presences evenly over the set of subscenes
ClientView client = (ClientView) pre.ControllingClient;
client.PacketProcessingEnabled = (( (i + myID) % sceneURL.Length) == 0);
m_log.InfoFormat("[SPLITSCENE] === SplitRegion {0}: SP.PacketEnabled {1}", region.RegionID, client.PacketProcessingEnabled); List<uint> circuits = scene.ClientManager.GetAllCircuitCodes();
circuits.Sort();
if (!client.PacketProcessingEnabled) IClientAPI controller = null;
{
// stopping clientview thread
client.Stop();
}
++i; foreach (uint code in circuits)
} {
m_log.InfoFormat("[BALANCER] "+"circuit code : {0}", code);
if (scene.ClientManager.TryGetClient(code, out controller))
{
// Divide the presences evenly over the set of subscenes
ClientView client = (ClientView) controller;
client.PacketProcessingEnabled = (( (i + myID) % sceneURL.Length) == 0);
m_log.InfoFormat("[SPLITSCENE] === SplitRegion {0}: SP.PacketEnabled {1}", region.RegionID, client.PacketProcessingEnabled);
if (!client.PacketProcessingEnabled)
{
// stopping clientview thread
client.Stop();
}
++i;
}
}
scene.splitID = myID; scene.splitID = myID;
scene.SynchronizeScene = new Scene.SynchronizeSceneHandler(SynchronizeScenes); scene.SynchronizeScene = new Scene.SynchronizeSceneHandler(SynchronizeScenes);