diff options
author | Johan Berntsson | 2008-03-04 09:39:58 +0000 |
---|---|---|
committer | Johan Berntsson | 2008-03-04 09:39:58 +0000 |
commit | c78eebfdfc64929d70b23e793475e89dc2f46de2 (patch) | |
tree | eaf6acecf3ff4ead352b14aabc5ce2ccd63e8c38 | |
parent | Fixed SQL update error (diff) | |
download | opensim-SC_OLD-c78eebfdfc64929d70b23e793475e89dc2f46de2.zip opensim-SC_OLD-c78eebfdfc64929d70b23e793475e89dc2f46de2.tar.gz opensim-SC_OLD-c78eebfdfc64929d70b23e793475e89dc2f46de2.tar.bz2 opensim-SC_OLD-c78eebfdfc64929d70b23e793475e89dc2f46de2.tar.xz |
Fixed a region split synchronization bug
-rw-r--r-- | OpenSim/Framework/ClientManager.cs | 11 | ||||
-rw-r--r-- | ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs | 54 |
2 files changed, 35 insertions, 30 deletions
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs index 39d8d99..a55e27c 100644 --- a/OpenSim/Framework/ClientManager.cs +++ b/OpenSim/Framework/ClientManager.cs | |||
@@ -158,6 +158,17 @@ namespace OpenSim.Framework | |||
158 | return circuits.ToArray(); | 158 | return circuits.ToArray(); |
159 | } | 159 | } |
160 | 160 | ||
161 | public List<uint> GetAllCircuitCodes() | ||
162 | { | ||
163 | List<uint> circuits; | ||
164 | |||
165 | lock (m_clients) | ||
166 | { | ||
167 | circuits = new List<uint>(m_clients.Keys); | ||
168 | } | ||
169 | |||
170 | return circuits; | ||
171 | } | ||
161 | 172 | ||
162 | public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) | 173 | public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) |
163 | { | 174 | { |
diff --git a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs index f58e0ee..267fe3c 100644 --- a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs +++ b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs | |||
@@ -525,21 +525,6 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
525 | udpserv = SearchUDPServerFromPortNum(scene.RegionInfo.InternalEndPoint.Port); | 525 | udpserv = SearchUDPServerFromPortNum(scene.RegionInfo.InternalEndPoint.Port); |
526 | 526 | ||
527 | // restore the scene presence | 527 | // restore the scene presence |
528 | /* | ||
529 | files = Directory.GetFiles(import_dir, "Presence_*.bin"); | ||
530 | Array.Sort(files); | ||
531 | |||
532 | foreach (string filename in files) | ||
533 | { | ||
534 | sp = (ScenePresence)Util.DeserializeFromFile(filename); | ||
535 | Console.WriteLine("agent id = {0}", sp.m_uuid); | ||
536 | |||
537 | scene.m_restorePresences.Add(sp.m_uuid, sp); | ||
538 | File.Delete(filename); | ||
539 | |||
540 | m_log.InfoFormat("[BALANCER] "+"scene presence deserialized [{0}]", sp.m_uuid); | ||
541 | } | ||
542 | */ | ||
543 | for (int i = 0; ; i++) | 528 | for (int i = 0; ; i++) |
544 | { | 529 | { |
545 | string filename = import_dir + "Presence_" + String.Format("{0:0000}", i) + ".bin"; | 530 | string filename = import_dir + "Presence_" + String.Format("{0:0000}", i) + ".bin"; |
@@ -746,25 +731,34 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
746 | // Disabling half of the avatars in master, and the other half in slave | 731 | // Disabling half of the avatars in master, and the other half in slave |
747 | 732 | ||
748 | int i = 0; | 733 | int i = 0; |
749 | List<ScenePresence> presences = scene.GetScenePresences(); | ||
750 | presences.Sort(); | ||
751 | foreach (ScenePresence pre in presences) | ||
752 | { | ||
753 | // Divide the presences evenly over the set of subscenes | ||
754 | ClientView client = (ClientView) pre.ControllingClient; | ||
755 | client.PacketProcessingEnabled = (( (i + myID) % sceneURL.Length) == 0); | ||
756 | 734 | ||
757 | m_log.InfoFormat("[SPLITSCENE] === SplitRegion {0}: SP.PacketEnabled {1}", region.RegionID, client.PacketProcessingEnabled); | 735 | List<uint> circuits = scene.ClientManager.GetAllCircuitCodes(); |
736 | circuits.Sort(); | ||
758 | 737 | ||
759 | if (!client.PacketProcessingEnabled) | 738 | IClientAPI controller = null; |
760 | { | ||
761 | // stopping clientview thread | ||
762 | client.Stop(); | ||
763 | } | ||
764 | 739 | ||
765 | ++i; | 740 | foreach (uint code in circuits) |
766 | } | 741 | { |
742 | m_log.InfoFormat("[BALANCER] "+"circuit code : {0}", code); | ||
743 | |||
744 | if (scene.ClientManager.TryGetClient(code, out controller)) | ||
745 | { | ||
746 | // Divide the presences evenly over the set of subscenes | ||
747 | ClientView client = (ClientView) controller; | ||
748 | client.PacketProcessingEnabled = (( (i + myID) % sceneURL.Length) == 0); | ||
749 | |||
750 | m_log.InfoFormat("[SPLITSCENE] === SplitRegion {0}: SP.PacketEnabled {1}", region.RegionID, client.PacketProcessingEnabled); | ||
751 | |||
752 | if (!client.PacketProcessingEnabled) | ||
753 | { | ||
754 | // stopping clientview thread | ||
755 | client.Stop(); | ||
756 | } | ||
767 | 757 | ||
758 | ++i; | ||
759 | } | ||
760 | } | ||
761 | |||
768 | scene.splitID = myID; | 762 | scene.splitID = myID; |
769 | scene.SynchronizeScene = new Scene.SynchronizeSceneHandler(SynchronizeScenes); | 763 | scene.SynchronizeScene = new Scene.SynchronizeSceneHandler(SynchronizeScenes); |
770 | isSplit = true; | 764 | isSplit = true; |