diff options
author | John Hurliman | 2009-10-13 17:33:45 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-13 17:33:45 -0700 |
commit | dc11643c007adf7a640ec4fbabe25995352aaa18 (patch) | |
tree | 108b5f7234756c5395d4ca518cfeb03454f62ace | |
parent | * Fixed a bug where clients were being added to ClientManager twice (diff) | |
download | opensim-SC_OLD-dc11643c007adf7a640ec4fbabe25995352aaa18.zip opensim-SC_OLD-dc11643c007adf7a640ec4fbabe25995352aaa18.tar.gz opensim-SC_OLD-dc11643c007adf7a640ec4fbabe25995352aaa18.tar.bz2 opensim-SC_OLD-dc11643c007adf7a640ec4fbabe25995352aaa18.tar.xz |
* Consolidated adding / removing ClientManager IClientAPIs to two places in Scene
* Added some missing implementations of IClientAPI.RemoteEndPoint
* Added a ClientManager.Remove(UUID) overload
* Removed a reference to a missing project from prebuild.xml
-rw-r--r-- | OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs | 6 | ||||
-rw-r--r-- | OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs | 5 | ||||
-rw-r--r-- | OpenSim/Framework/ClientManager.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 61 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 1 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestClient.cs | 5 | ||||
-rw-r--r-- | prebuild.xml | 1 |
11 files changed, 38 insertions, 78 deletions
diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs index d5dc18f..ba9c653 100644 --- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs +++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs | |||
@@ -339,12 +339,6 @@ namespace OpenSim.Client.MXP.PacketHandler | |||
339 | m_clients.Add(client); | 339 | m_clients.Add(client); |
340 | m_log.Debug("[MXP ClientStack]: Created ClientView."); | 340 | m_log.Debug("[MXP ClientStack]: Created ClientView."); |
341 | 341 | ||
342 | |||
343 | m_log.Debug("[MXP ClientStack]: Adding ClientView to Scene..."); | ||
344 | scene.ClientManager.Add(client.AgentId, client.RemoteEndPoint, client); | ||
345 | m_log.Debug("[MXP ClientStack]: Added ClientView to Scene."); | ||
346 | |||
347 | |||
348 | client.MXPSendSynchronizationBegin(m_scenes[new UUID(joinRequestMessage.BubbleId)].SceneContents.GetTotalObjectsCount()); | 342 | client.MXPSendSynchronizationBegin(m_scenes[new UUID(joinRequestMessage.BubbleId)].SceneContents.GetTotalObjectsCount()); |
349 | 343 | ||
350 | m_log.Debug("[MXP ClientStack]: Starting ClientView..."); | 344 | m_log.Debug("[MXP ClientStack]: Starting ClientView..."); |
diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index 9c24da5..e3abcf5 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs | |||
@@ -207,6 +207,11 @@ namespace OpenSim.Client.VWoHTTP.ClientStack | |||
207 | get { throw new System.NotImplementedException(); } | 207 | get { throw new System.NotImplementedException(); } |
208 | } | 208 | } |
209 | 209 | ||
210 | public IPEndPoint RemoteEndPoint | ||
211 | { | ||
212 | get { throw new System.NotImplementedException(); } | ||
213 | } | ||
214 | |||
210 | public event GenericMessage OnGenericMessage = delegate { }; | 215 | public event GenericMessage OnGenericMessage = delegate { }; |
211 | public event ImprovedInstantMessage OnInstantMessage = delegate { }; | 216 | public event ImprovedInstantMessage OnInstantMessage = delegate { }; |
212 | public event ChatMessage OnChatFromClient = delegate { }; | 217 | public event ChatMessage OnChatFromClient = delegate { }; |
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs index aefe425..fd5f87f 100644 --- a/OpenSim/Framework/ClientManager.cs +++ b/OpenSim/Framework/ClientManager.cs | |||
@@ -134,6 +134,20 @@ namespace OpenSim.Framework | |||
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | public void Remove(UUID key) | ||
138 | { | ||
139 | lock (m_writeLock) | ||
140 | { | ||
141 | IClientAPI client; | ||
142 | |||
143 | if (m_dict.TryGetValue(key, out client)) | ||
144 | { | ||
145 | m_dict = m_dict.Delete(key); | ||
146 | m_dict2 = m_dict2.Delete(client.RemoteEndPoint); | ||
147 | } | ||
148 | } | ||
149 | } | ||
150 | |||
137 | /// <summary> | 151 | /// <summary> |
138 | /// Resets the client collection | 152 | /// Resets the client collection |
139 | /// </summary> | 153 | /// </summary> |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index aecb362..0acf6e8 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -324,6 +324,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
324 | #region Properties | 324 | #region Properties |
325 | 325 | ||
326 | public LLUDPClient UDPClient { get { return m_udpClient; } } | 326 | public LLUDPClient UDPClient { get { return m_udpClient; } } |
327 | public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } } | ||
327 | public UUID SecureSessionId { get { return m_secureSessionId; } } | 328 | public UUID SecureSessionId { get { return m_secureSessionId; } } |
328 | public IScene Scene { get { return m_scene; } } | 329 | public IScene Scene { get { return m_scene; } } |
329 | public UUID SessionId { get { return m_sessionId; } } | 330 | public UUID SessionId { get { return m_sessionId; } } |
@@ -431,7 +432,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
431 | 432 | ||
432 | // Remove ourselves from the scene | 433 | // Remove ourselves from the scene |
433 | m_scene.RemoveClient(AgentId); | 434 | m_scene.RemoveClient(AgentId); |
434 | m_scene.ClientManager.Remove(this); | ||
435 | 435 | ||
436 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 436 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
437 | //GC.Collect(); | 437 | //GC.Collect(); |
@@ -586,11 +586,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
586 | 586 | ||
587 | # region Setup | 587 | # region Setup |
588 | 588 | ||
589 | /// <summary> | 589 | public virtual void Start() |
590 | /// Starts up the timers to check the client and resend unacked packets | ||
591 | /// Adds the client to the OpenSim.Region.Framework.Scenes.Scene | ||
592 | /// </summary> | ||
593 | protected virtual void InitNewClient() | ||
594 | { | 590 | { |
595 | m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate); | 591 | m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate); |
596 | m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates); | 592 | m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates); |
@@ -609,59 +605,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
609 | RefreshGroupMembership(); | 605 | RefreshGroupMembership(); |
610 | } | 606 | } |
611 | 607 | ||
612 | public virtual void Start() | ||
613 | { | ||
614 | // This sets up all the timers | ||
615 | InitNewClient(); | ||
616 | } | ||
617 | |||
618 | /// <summary> | ||
619 | /// Run a user session. This method lies at the base of the entire client thread. | ||
620 | /// </summary> | ||
621 | protected void RunUserSession() | ||
622 | { | ||
623 | try | ||
624 | { | ||
625 | |||
626 | } | ||
627 | catch (Exception e) | ||
628 | { | ||
629 | if (e is ThreadAbortException) | ||
630 | throw; | ||
631 | |||
632 | if (StatsManager.SimExtraStats != null) | ||
633 | StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); | ||
634 | |||
635 | // Don't let a failure in an individual client thread crash the whole sim. | ||
636 | m_log.ErrorFormat( | ||
637 | "[CLIENT]: Client thread for {0} {1} crashed. Logging them out.", Name, AgentId); | ||
638 | m_log.Error(e.ToString()); | ||
639 | |||
640 | try | ||
641 | { | ||
642 | // Make an attempt to alert the user that their session has crashed | ||
643 | AgentAlertMessagePacket packet | ||
644 | = BuildAgentAlertPacket( | ||
645 | "Unfortunately the session for this client on the server has crashed.\n" | ||
646 | + "Any further actions taken will not be processed.\n" | ||
647 | + "Please relog", true); | ||
648 | |||
649 | OutPacket(packet, ThrottleOutPacketType.Unknown); | ||
650 | |||
651 | // There may be a better way to do this. Perhaps kick? Not sure this propogates notifications to | ||
652 | // listeners yet, though. | ||
653 | Logout(this); | ||
654 | } | ||
655 | catch (Exception e2) | ||
656 | { | ||
657 | if (e2 is ThreadAbortException) | ||
658 | throw; | ||
659 | |||
660 | m_log.ErrorFormat("[CLIENT]: Further exception thrown on forced session logout. {0}", e2); | ||
661 | } | ||
662 | } | ||
663 | } | ||
664 | |||
665 | # endregion | 608 | # endregion |
666 | 609 | ||
667 | public void ActivateGesture(UUID assetId, UUID gestureId) | 610 | public void ActivateGesture(UUID assetId, UUID gestureId) |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 22c275c..8689af3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -646,7 +646,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
646 | client.OnConnectionClosed += ConnectionClosedHandler; | 646 | client.OnConnectionClosed += ConnectionClosedHandler; |
647 | 647 | ||
648 | // Start the IClientAPI | 648 | // Start the IClientAPI |
649 | m_scene.ClientManager.Add(client); | ||
650 | client.Start(); | 649 | client.Start(); |
651 | } | 650 | } |
652 | else | 651 | else |
@@ -658,10 +657,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
658 | 657 | ||
659 | private void RemoveClient(LLUDPClient udpClient) | 658 | private void RemoveClient(LLUDPClient udpClient) |
660 | { | 659 | { |
661 | // Remove this client from the scene ClientManager | 660 | // Remove this client from the scene |
662 | IClientAPI client; | 661 | IClientAPI client; |
663 | if (m_scene.ClientManager.TryGetValue(udpClient.AgentID, out client)) | 662 | if (m_scene.ClientManager.TryGetValue(udpClient.AgentID, out client)) |
664 | Util.FireAndForget(delegate(object o) { client.Close(); }); | 663 | client.Close(); |
665 | } | 664 | } |
666 | 665 | ||
667 | private void AcknowledgePacket(LLUDPClient client, uint ack, int currentTime, bool fromResend) | 666 | private void AcknowledgePacket(LLUDPClient client, uint ack, int currentTime, bool fromResend) |
@@ -810,19 +809,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
810 | private void LogoutHandler(IClientAPI client) | 809 | private void LogoutHandler(IClientAPI client) |
811 | { | 810 | { |
812 | client.OnLogout -= LogoutHandler; | 811 | client.OnLogout -= LogoutHandler; |
813 | |||
814 | client.SendLogoutPacket(); | 812 | client.SendLogoutPacket(); |
815 | |||
816 | if (client is LLClientView) | ||
817 | RemoveClient(((LLClientView)client).UDPClient); | ||
818 | } | 813 | } |
819 | 814 | ||
820 | private void ConnectionClosedHandler(IClientAPI client) | 815 | private void ConnectionClosedHandler(IClientAPI client) |
821 | { | 816 | { |
822 | client.OnConnectionClosed -= ConnectionClosedHandler; | 817 | client.OnConnectionClosed -= ConnectionClosedHandler; |
823 | 818 | RemoveClient(((LLClientView)client).UDPClient); | |
824 | if (client is LLClientView) | ||
825 | RemoveClient(((LLClientView)client).UDPClient); | ||
826 | } | 819 | } |
827 | } | 820 | } |
828 | } | 821 | } |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index dcee824..d651fd4 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -833,6 +833,11 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
833 | set { m_circuitCode = value; } | 833 | set { m_circuitCode = value; } |
834 | } | 834 | } |
835 | 835 | ||
836 | public IPEndPoint RemoteEndPoint | ||
837 | { | ||
838 | get { return new IPEndPoint(IPAddress.Loopback, (ushort)m_circuitCode); } | ||
839 | } | ||
840 | |||
836 | public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message) | 841 | public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message) |
837 | { | 842 | { |
838 | 843 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index bb71896..7944548 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2363,6 +2363,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2363 | /// <param name="client"></param> | 2363 | /// <param name="client"></param> |
2364 | public override void AddNewClient(IClientAPI client) | 2364 | public override void AddNewClient(IClientAPI client) |
2365 | { | 2365 | { |
2366 | ClientManager.Add(client); | ||
2367 | |||
2366 | CheckHeartbeat(); | 2368 | CheckHeartbeat(); |
2367 | SubscribeToClientEvents(client); | 2369 | SubscribeToClientEvents(client); |
2368 | ScenePresence presence; | 2370 | ScenePresence presence; |
@@ -3002,7 +3004,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3002 | agentTransactions.RemoveAgentAssetTransactions(agentID); | 3004 | agentTransactions.RemoveAgentAssetTransactions(agentID); |
3003 | } | 3005 | } |
3004 | 3006 | ||
3007 | // Remove the avatar from the scene | ||
3005 | m_sceneGraph.RemoveScenePresence(agentID); | 3008 | m_sceneGraph.RemoveScenePresence(agentID); |
3009 | ClientManager.Remove(agentID); | ||
3006 | 3010 | ||
3007 | try | 3011 | try |
3008 | { | 3012 | { |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs index c962329..4c2a4b9 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs | |||
@@ -64,7 +64,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView | |||
64 | void user_OnIRCReady(IRCClientView cv) | 64 | void user_OnIRCReady(IRCClientView cv) |
65 | { | 65 | { |
66 | m_log.Info("[IRCd] Adding user..."); | 66 | m_log.Info("[IRCd] Adding user..."); |
67 | m_scene.ClientManager.Add(cv.AgentId, cv.RemoteEndPoint, cv); | ||
68 | cv.Start(); | 67 | cv.Start(); |
69 | m_log.Info("[IRCd] Added user to Scene"); | 68 | m_log.Info("[IRCd] Added user to Scene"); |
70 | } | 69 | } |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index eb7b0d7..41a6255 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -155,7 +155,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
155 | NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene); | 155 | NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene); |
156 | npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue); | 156 | npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue); |
157 | 157 | ||
158 | p_scene.ClientManager.Add(npcAvatar.AgentId, npcAvatar.RemoteEndPoint, npcAvatar); | ||
159 | p_scene.AddNewClient(npcAvatar); | 158 | p_scene.AddNewClient(npcAvatar); |
160 | 159 | ||
161 | ScenePresence sp; | 160 | ScenePresence sp; |
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index ad90817..5c838c5 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -393,6 +393,11 @@ namespace OpenSim.Tests.Common.Mock | |||
393 | set { m_circuitCode = value; } | 393 | set { m_circuitCode = value; } |
394 | } | 394 | } |
395 | 395 | ||
396 | public IPEndPoint RemoteEndPoint | ||
397 | { | ||
398 | get { return new IPEndPoint(IPAddress.Loopback, (ushort)m_circuitCode); } | ||
399 | } | ||
400 | |||
396 | /// <summary> | 401 | /// <summary> |
397 | /// Constructor | 402 | /// Constructor |
398 | /// </summary> | 403 | /// </summary> |
diff --git a/prebuild.xml b/prebuild.xml index f15fadf..1a491a7 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -3497,7 +3497,6 @@ | |||
3497 | <Reference name="OpenSim.Tests.Common"/> | 3497 | <Reference name="OpenSim.Tests.Common"/> |
3498 | <Reference name="OpenSim.Framework"/> | 3498 | <Reference name="OpenSim.Framework"/> |
3499 | <Reference name="OpenSim.Framework.Serialization"/> | 3499 | <Reference name="OpenSim.Framework.Serialization"/> |
3500 | <Reference name="OpenSim.Framework.Serialization.External"/> | ||
3501 | <Reference name="log4net.dll"/> | 3500 | <Reference name="log4net.dll"/> |
3502 | <Reference name="nunit.framework.dll" /> | 3501 | <Reference name="nunit.framework.dll" /> |
3503 | 3502 | ||