diff options
author | Melanie | 2012-06-12 03:09:52 +0100 |
---|---|---|
committer | Melanie | 2012-06-12 03:09:52 +0100 |
commit | dfafb5ca1451a407eafa6fbdc0246d6bdb962531 (patch) | |
tree | 62a3ba18f0ea09be7ec0bcbc3afdc701f592c7e6 /OpenSim | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Remove accidental timeout left in during earlier debugging. Has been in sinc... (diff) | |
download | opensim-SC-dfafb5ca1451a407eafa6fbdc0246d6bdb962531.zip opensim-SC-dfafb5ca1451a407eafa6fbdc0246d6bdb962531.tar.gz opensim-SC-dfafb5ca1451a407eafa6fbdc0246d6bdb962531.tar.bz2 opensim-SC-dfafb5ca1451a407eafa6fbdc0246d6bdb962531.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
Diffstat (limited to '')
10 files changed, 97 insertions, 98 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c1bd078..af76ea9 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -749,14 +749,21 @@ namespace OpenSim.Framework | |||
749 | /// </summary> | 749 | /// </summary> |
750 | string Name { get; } | 750 | string Name { get; } |
751 | 751 | ||
752 | /// <value> | 752 | /// <summary> |
753 | /// Determines whether the client thread is doing anything or not. | 753 | /// True if the client is active (sending and receiving new UDP messages). False if the client is being closed. |
754 | /// </value> | 754 | /// </summary> |
755 | bool IsActive { get; set; } | 755 | bool IsActive { get; set; } |
756 | 756 | ||
757 | /// <value> | 757 | /// <summary> |
758 | /// Determines whether the client is or has been removed from a given scene | 758 | /// Set if the client is closing due to a logout request |
759 | /// </value> | 759 | /// </summary> |
760 | /// <remarks> | ||
761 | /// Do not use this flag if you want to know if the client is closing, since it will not be set in other | ||
762 | /// circumstances (e.g. if a child agent is closed or the agent is kicked off the simulator). Use IsActive | ||
763 | /// instead with a IClientAPI.SceneAgent.IsChildAgent check if necessary. | ||
764 | /// | ||
765 | /// Only set for root agents. | ||
766 | /// </remarks> | ||
760 | bool IsLoggingOut { get; set; } | 767 | bool IsLoggingOut { get; set; } |
761 | 768 | ||
762 | bool SendLogoutPacketWhenClosing { set; } | 769 | bool SendLogoutPacketWhenClosing { set; } |
diff --git a/OpenSim/Framework/ISceneAgent.cs b/OpenSim/Framework/ISceneAgent.cs index 824172d..563d906 100644 --- a/OpenSim/Framework/ISceneAgent.cs +++ b/OpenSim/Framework/ISceneAgent.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using OpenMetaverse; | ||
29 | 30 | ||
30 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework |
31 | { | 32 | { |
@@ -71,5 +72,11 @@ namespace OpenSim.Framework | |||
71 | /// This includes scene object data and the appearance data of other avatars. | 72 | /// This includes scene object data and the appearance data of other avatars. |
72 | /// </remarks> | 73 | /// </remarks> |
73 | void SendInitialDataToMe(); | 74 | void SendInitialDataToMe(); |
75 | |||
76 | /// <summary> | ||
77 | /// Direction in which the scene presence is looking. | ||
78 | /// </summary> | ||
79 | /// <remarks>Will be Vector3.Zero for a child agent.</remarks> | ||
80 | Vector3 Lookat { get; } | ||
74 | } | 81 | } |
75 | } \ No newline at end of file | 82 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 18d8045..b40eeed 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -515,6 +515,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
515 | /// </summary> | 515 | /// </summary> |
516 | public void Close(bool sendStop) | 516 | public void Close(bool sendStop) |
517 | { | 517 | { |
518 | IsActive = false; | ||
519 | |||
518 | m_log.DebugFormat( | 520 | m_log.DebugFormat( |
519 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 521 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
520 | Name, m_scene.RegionInfo.RegionName); | 522 | Name, m_scene.RegionInfo.RegionName); |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 3c23dcf..22cc194 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -555,12 +555,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
555 | if (udpClient.IsPaused) | 555 | if (udpClient.IsPaused) |
556 | timeoutTicks = m_pausedAckTimeout; | 556 | timeoutTicks = m_pausedAckTimeout; |
557 | 557 | ||
558 | if (!client.IsLoggingOut && | 558 | if (client.IsActive && |
559 | (Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > timeoutTicks) | 559 | (Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > timeoutTicks) |
560 | { | 560 | { |
561 | m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID); | 561 | // We must set IsActive synchronously so that we can stop the packet loop reinvoking this method, even |
562 | StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); | 562 | // though it's set later on by LLClientView.Close() |
563 | RemoveClient(client); | 563 | client.IsActive = false; |
564 | |||
565 | // Fire this out on a different thread so that we don't hold up outgoing packet processing for | ||
566 | // everybody else if this is being called due to an ack timeout. | ||
567 | // This is the same as processing as the async process of a logout request. | ||
568 | Util.FireAndForget(o => DeactivateClientDueToTimeout(client)); | ||
564 | 569 | ||
565 | return; | 570 | return; |
566 | } | 571 | } |
@@ -1110,9 +1115,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1110 | return client; | 1115 | return client; |
1111 | } | 1116 | } |
1112 | 1117 | ||
1113 | private void RemoveClient(IClientAPI client) | 1118 | /// <summary> |
1119 | /// Deactivates the client if we don't receive any packets within a certain amount of time (default 60 seconds). | ||
1120 | /// </summary> | ||
1121 | /// <remarks> | ||
1122 | /// If a connection is active then we will always receive packets even if nothing else is happening, due to | ||
1123 | /// regular client pings. | ||
1124 | /// </remarks> | ||
1125 | /// <param name='client'></param> | ||
1126 | private void DeactivateClientDueToTimeout(IClientAPI client) | ||
1114 | { | 1127 | { |
1115 | client.IsLoggingOut = true; | 1128 | // We must set IsActive synchronously so that we can stop the packet loop reinvoking this method, even |
1129 | // though it's set later on by LLClientView.Close() | ||
1130 | client.IsActive = false; | ||
1131 | |||
1132 | m_log.WarnFormat( | ||
1133 | "[LLUDPSERVER]: Ack timeout, disconnecting {0} agent for {1} in {2}", | ||
1134 | client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, m_scene.RegionInfo.RegionName); | ||
1135 | |||
1136 | StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); | ||
1137 | |||
1138 | if (!client.SceneAgent.IsChildAgent) | ||
1139 | client.Kick("Simulator logged you out due to connection timeout"); | ||
1140 | |||
1116 | Util.FireAndForget(o => client.Close()); | 1141 | Util.FireAndForget(o => client.Close()); |
1117 | } | 1142 | } |
1118 | 1143 | ||
@@ -1429,8 +1454,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1429 | protected void LogoutHandler(IClientAPI client) | 1454 | protected void LogoutHandler(IClientAPI client) |
1430 | { | 1455 | { |
1431 | client.SendLogoutPacket(); | 1456 | client.SendLogoutPacket(); |
1457 | |||
1432 | if (!client.IsLoggingOut) | 1458 | if (!client.IsLoggingOut) |
1433 | RemoveClient(client); | 1459 | { |
1460 | client.IsLoggingOut = true; | ||
1461 | client.Close(); | ||
1462 | } | ||
1434 | } | 1463 | } |
1435 | } | 1464 | } |
1436 | } | 1465 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 7e71fd1..3010b59 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -328,34 +328,30 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
328 | 328 | ||
329 | void OnConnectionClosed(IClientAPI obj) | 329 | void OnConnectionClosed(IClientAPI obj) |
330 | { | 330 | { |
331 | if (obj.IsLoggingOut) | 331 | if (obj.SceneAgent.IsChildAgent) |
332 | { | 332 | return; |
333 | object sp = null; | ||
334 | if (obj.Scene.TryGetScenePresence(obj.AgentId, out sp)) | ||
335 | { | ||
336 | if (((ScenePresence)sp).IsChildAgent) | ||
337 | return; | ||
338 | } | ||
339 | 333 | ||
340 | // Let's find out if this is a foreign user or a local user | 334 | // Let's find out if this is a foreign user or a local user |
341 | IUserManagement uMan = Scene.RequestModuleInterface<IUserManagement>(); | 335 | IUserManagement uMan = Scene.RequestModuleInterface<IUserManagement>(); |
342 | // UserAccount account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, obj.AgentId); | 336 | // UserAccount account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, obj.AgentId); |
343 | if (uMan != null && uMan.IsLocalGridUser(obj.AgentId)) | ||
344 | { | ||
345 | // local grid user | ||
346 | return; | ||
347 | } | ||
348 | 337 | ||
349 | AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); | 338 | if (uMan != null && uMan.IsLocalGridUser(obj.AgentId)) |
339 | { | ||
340 | // local grid user | ||
341 | return; | ||
342 | } | ||
350 | 343 | ||
351 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 344 | AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); |
352 | { | 345 | |
353 | string url = aCircuit.ServiceURLs["HomeURI"].ToString(); | 346 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |
354 | IUserAgentService security = new UserAgentServiceConnector(url); | 347 | { |
355 | security.LogoutAgent(obj.AgentId, obj.SessionId); | 348 | string url = aCircuit.ServiceURLs["HomeURI"].ToString(); |
356 | //m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Sent logout call to UserAgentService @ {0}", url); | 349 | IUserAgentService security = new UserAgentServiceConnector(url); |
357 | } | 350 | security.LogoutAgent(obj.AgentId, obj.SessionId); |
358 | else | 351 | //m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Sent logout call to UserAgentService @ {0}", url); |
352 | } | ||
353 | else | ||
354 | { | ||
359 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: HomeURI not found for agent {0} logout", obj.AgentId); | 355 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: HomeURI not found for agent {0} logout", obj.AgentId); |
360 | } | 356 | } |
361 | } | 357 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs index 4cf62ec..b0edce7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs | |||
@@ -79,29 +79,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | |||
79 | 79 | ||
80 | public void OnConnectionClose(IClientAPI client) | 80 | public void OnConnectionClose(IClientAPI client) |
81 | { | 81 | { |
82 | if (client.IsLoggingOut) | 82 | if (client.SceneAgent.IsChildAgent) |
83 | { | 83 | return; |
84 | object sp = null; | ||
85 | Vector3 position = new Vector3(128, 128, 0); | ||
86 | Vector3 lookat = new Vector3(0, 1, 0); | ||
87 | |||
88 | if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) | ||
89 | { | ||
90 | if (sp is ScenePresence) | ||
91 | { | ||
92 | if (((ScenePresence)sp).IsChildAgent) | ||
93 | return; | ||
94 | |||
95 | position = ((ScenePresence)sp).AbsolutePosition; | ||
96 | lookat = ((ScenePresence)sp).Lookat; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | // m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); | ||
101 | m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat); | ||
102 | } | ||
103 | 84 | ||
85 | // m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); | ||
86 | m_GridUserService.LoggedOut( | ||
87 | client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, | ||
88 | client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat); | ||
104 | } | 89 | } |
105 | |||
106 | } | 90 | } |
107 | } | 91 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs index ccfbf78..172bea1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs | |||
@@ -64,7 +64,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
64 | scene.EventManager.OnNewClient -= OnNewClient; | 64 | scene.EventManager.OnNewClient -= OnNewClient; |
65 | 65 | ||
66 | m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID); | 66 | m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID); |
67 | |||
68 | } | 67 | } |
69 | 68 | ||
70 | public void OnMakeRootAgent(ScenePresence sp) | 69 | public void OnMakeRootAgent(ScenePresence sp) |
@@ -80,18 +79,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
80 | 79 | ||
81 | public void OnConnectionClose(IClientAPI client) | 80 | public void OnConnectionClose(IClientAPI client) |
82 | { | 81 | { |
83 | if (client.IsLoggingOut) | 82 | if (!client.SceneAgent.IsChildAgent) |
84 | { | 83 | { |
85 | object sp = null; | ||
86 | if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) | ||
87 | { | ||
88 | if (sp is ScenePresence) | ||
89 | { | ||
90 | if (((ScenePresence)sp).IsChildAgent) | ||
91 | return; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | // m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); | 84 | // m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); |
96 | m_PresenceService.LogoutAgent(client.SessionId); | 85 | m_PresenceService.LogoutAgent(client.SessionId); |
97 | } | 86 | } |
diff --git a/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs b/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs index 9cb5674..d9d2e64 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs | |||
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | if (fh.Client.IsLoggingOut) | 140 | if (!fh.Client.IsActive) |
141 | continue; | 141 | continue; |
142 | 142 | ||
143 | // m_log.DebugFormat( | 143 | // m_log.DebugFormat( |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3095382..85bae9a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3617,10 +3617,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3617 | // Or the same user is trying to be root twice here, won't work. | 3617 | // Or the same user is trying to be root twice here, won't work. |
3618 | // Kill it. | 3618 | // Kill it. |
3619 | m_log.DebugFormat( | 3619 | m_log.DebugFormat( |
3620 | "[SCENE]: Zombie scene presence detected for {0} in {1}", | 3620 | "[SCENE]: Zombie scene presence detected for {0} {1} in {2}", |
3621 | agent.AgentID, | 3621 | sp.Name, sp.UUID, RegionInfo.RegionName); |
3622 | RegionInfo.RegionName | 3622 | |
3623 | ); | ||
3624 | sp.ControllingClient.Close(); | 3623 | sp.ControllingClient.Close(); |
3625 | sp = null; | 3624 | sp = null; |
3626 | } | 3625 | } |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs index 2267325..95e4bab 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs | |||
@@ -79,27 +79,13 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
79 | 79 | ||
80 | public void OnConnectionClose(IClientAPI client) | 80 | public void OnConnectionClose(IClientAPI client) |
81 | { | 81 | { |
82 | if (client.IsLoggingOut) | 82 | if (client.SceneAgent.IsChildAgent) |
83 | { | 83 | return; |
84 | object sp = null; | ||
85 | Vector3 position = new Vector3(128, 128, 0); | ||
86 | Vector3 lookat = new Vector3(0, 1, 0); | ||
87 | |||
88 | if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) | ||
89 | { | ||
90 | if (sp is ScenePresence) | ||
91 | { | ||
92 | if (((ScenePresence)sp).IsChildAgent) | ||
93 | return; | ||
94 | |||
95 | position = ((ScenePresence)sp).AbsolutePosition; | ||
96 | lookat = ((ScenePresence)sp).Lookat; | ||
97 | } | ||
98 | } | ||
99 | 84 | ||
100 | // m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); | 85 | // m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); |
101 | m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat); | 86 | m_GridUserService.LoggedOut( |
102 | } | 87 | client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, |
88 | client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat); | ||
103 | } | 89 | } |
104 | 90 | ||
105 | void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) | 91 | void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) |
@@ -111,4 +97,4 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
111 | }); | 97 | }); |
112 | } | 98 | } |
113 | } | 99 | } |
114 | } | 100 | } \ No newline at end of file |