diff options
author | John Hurliman | 2009-10-26 16:48:43 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-26 16:48:43 -0700 |
commit | 0b1726b524934c2020aaf2b1f130219fb87003fd (patch) | |
tree | aa65455b68e8b595876f3f54479d96ce749bdedb /OpenSim/Region | |
parent | * Switched all operations on the list of clients that could be either sync or... (diff) | |
download | opensim-SC-0b1726b524934c2020aaf2b1f130219fb87003fd.zip opensim-SC-0b1726b524934c2020aaf2b1f130219fb87003fd.tar.gz opensim-SC-0b1726b524934c2020aaf2b1f130219fb87003fd.tar.bz2 opensim-SC-0b1726b524934c2020aaf2b1f130219fb87003fd.tar.xz |
Removing the ClientManager reference from IScene and hiding it entirely inside Scene as an implementation detail. This will reduce programming error and make it easier to refactor the avatar vs client vs presence mess later on
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneBase.cs | 7 |
4 files changed, 30 insertions, 20 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 0366d94..b448182 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -970,12 +970,12 @@ namespace OpenSim | |||
970 | m_sceneManager.ForEachScene( | 970 | m_sceneManager.ForEachScene( |
971 | delegate(Scene scene) | 971 | delegate(Scene scene) |
972 | { | 972 | { |
973 | scene.ClientManager.ForEachSync( | 973 | scene.ForEachClient( |
974 | delegate(IClientAPI client) | 974 | delegate(IClientAPI client) |
975 | { | 975 | { |
976 | connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n", | 976 | connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n", |
977 | scene.RegionInfo.RegionName, client.Name, client.AgentId, client.RemoteEndPoint, client.CircuitCode); | 977 | scene.RegionInfo.RegionName, client.Name, client.AgentId, client.RemoteEndPoint, client.CircuitCode); |
978 | } | 978 | }, false |
979 | ); | 979 | ); |
980 | } | 980 | } |
981 | ); | 981 | ); |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index dee0a39..e3233da 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -583,10 +583,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
583 | 583 | ||
584 | // Determine which agent this packet came from | 584 | // Determine which agent this packet came from |
585 | IClientAPI client; | 585 | IClientAPI client; |
586 | if (!m_scene.ClientManager.TryGetValue(address, out client) || !(client is LLClientView)) | 586 | if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) |
587 | { | 587 | { |
588 | m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + | 588 | m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); |
589 | " in " + m_scene.RegionInfo.RegionName + ", currently tracking " + m_scene.ClientManager.Count + " clients"); | ||
590 | return; | 589 | return; |
591 | } | 590 | } |
592 | 591 | ||
@@ -764,8 +763,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
764 | { | 763 | { |
765 | // Create the LLUDPClient | 764 | // Create the LLUDPClient |
766 | LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint); | 765 | LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint); |
766 | IClientAPI existingClient; | ||
767 | 767 | ||
768 | if (!m_scene.ClientManager.ContainsKey(agentID)) | 768 | if (!m_scene.TryGetClient(agentID, out existingClient)) |
769 | { | 769 | { |
770 | // Create the LLClientView | 770 | // Create the LLClientView |
771 | LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); | 771 | LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); |
@@ -785,7 +785,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
785 | { | 785 | { |
786 | // Remove this client from the scene | 786 | // Remove this client from the scene |
787 | IClientAPI client; | 787 | IClientAPI client; |
788 | if (m_scene.ClientManager.TryGetValue(udpClient.AgentID, out client)) | 788 | if (m_scene.TryGetClient(udpClient.AgentID, out client)) |
789 | client.Close(); | 789 | client.Close(); |
790 | } | 790 | } |
791 | 791 | ||
@@ -877,7 +877,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
877 | 877 | ||
878 | // Handle outgoing packets, resends, acknowledgements, and pings for each | 878 | // Handle outgoing packets, resends, acknowledgements, and pings for each |
879 | // client. m_packetSent will be set to true if a packet is sent | 879 | // client. m_packetSent will be set to true if a packet is sent |
880 | m_scene.ClientManager.ForEachSync(clientPacketHandler); | 880 | m_scene.ForEachClient(clientPacketHandler, false); |
881 | 881 | ||
882 | // If nothing was sent, sleep for the minimum amount of time before a | 882 | // If nothing was sent, sleep for the minimum amount of time before a |
883 | // token bucket could get more tokens | 883 | // token bucket could get more tokens |
@@ -942,7 +942,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
942 | } | 942 | } |
943 | 943 | ||
944 | // Make sure this client is still alive | 944 | // Make sure this client is still alive |
945 | if (m_scene.ClientManager.TryGetValue(udpClient.AgentID, out client)) | 945 | if (m_scene.TryGetClient(udpClient.AgentID, out client)) |
946 | { | 946 | { |
947 | try | 947 | try |
948 | { | 948 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 91367db..7eafef7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2482,7 +2482,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2482 | /// <param name="client"></param> | 2482 | /// <param name="client"></param> |
2483 | public override void AddNewClient(IClientAPI client) | 2483 | public override void AddNewClient(IClientAPI client) |
2484 | { | 2484 | { |
2485 | ClientManager.Add(client); | 2485 | m_clientManager.Add(client); |
2486 | 2486 | ||
2487 | CheckHeartbeat(); | 2487 | CheckHeartbeat(); |
2488 | SubscribeToClientEvents(client); | 2488 | SubscribeToClientEvents(client); |
@@ -3121,7 +3121,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3121 | 3121 | ||
3122 | // Remove the avatar from the scene | 3122 | // Remove the avatar from the scene |
3123 | m_sceneGraph.RemoveScenePresence(agentID); | 3123 | m_sceneGraph.RemoveScenePresence(agentID); |
3124 | ClientManager.Remove(agentID); | 3124 | m_clientManager.Remove(agentID); |
3125 | 3125 | ||
3126 | try | 3126 | try |
3127 | { | 3127 | { |
@@ -4256,10 +4256,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
4256 | 4256 | ||
4257 | public void ForEachClient(Action<IClientAPI> action) | 4257 | public void ForEachClient(Action<IClientAPI> action) |
4258 | { | 4258 | { |
4259 | if (m_useAsyncWhenPossible) | 4259 | ForEachClient(action, m_useAsyncWhenPossible); |
4260 | ClientManager.ForEach(action); | 4260 | } |
4261 | |||
4262 | public void ForEachClient(Action<IClientAPI> action, bool doAsynchronous) | ||
4263 | { | ||
4264 | if (doAsynchronous) | ||
4265 | m_clientManager.ForEach(action); | ||
4261 | else | 4266 | else |
4262 | ClientManager.ForEachSync(action); | 4267 | m_clientManager.ForEachSync(action); |
4268 | } | ||
4269 | |||
4270 | public bool TryGetClient(UUID avatarID, out IClientAPI client) | ||
4271 | { | ||
4272 | return m_clientManager.TryGetValue(avatarID, out client); | ||
4273 | } | ||
4274 | |||
4275 | public bool TryGetClient(System.Net.IPEndPoint remoteEndPoint, out IClientAPI client) | ||
4276 | { | ||
4277 | return m_clientManager.TryGetValue(remoteEndPoint, out client); | ||
4263 | } | 4278 | } |
4264 | 4279 | ||
4265 | public void ForEachSOG(Action<SceneObjectGroup> action) | 4280 | public void ForEachSOG(Action<SceneObjectGroup> action) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index cf5c3c8..82731d1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -102,12 +102,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
102 | 102 | ||
103 | private readonly Mutex _primAllocateMutex = new Mutex(false); | 103 | private readonly Mutex _primAllocateMutex = new Mutex(false); |
104 | 104 | ||
105 | private readonly ClientManager m_clientManager = new ClientManager(); | 105 | protected readonly ClientManager m_clientManager = new ClientManager(); |
106 | |||
107 | public ClientManager ClientManager | ||
108 | { | ||
109 | get { return m_clientManager; } | ||
110 | } | ||
111 | 106 | ||
112 | public float TimeDilation | 107 | public float TimeDilation |
113 | { | 108 | { |