From 73fbacea1fe18873fab175d82189a1becb0f8e10 Mon Sep 17 00:00:00 2001
From: MW
Date: Mon, 5 Nov 2007 13:58:44 +0000
Subject: Started to cleanup/close down childagent connections when a user
teleports. As the client will not close old childagent connections without
being told explicitly to do so by each region the connection is to. Currently
only implemented in standalone mode. ( the TellRegionToCloseChildConnection(
) in OGS1GridServices.cs needs implementing for grid mode, and the inter
region .net remoting added for the new messages). hopefully fixed the echo
bug in chatmodule.
---
.../Scenes/SceneCommunicationService.cs | 37 ++++++++++++++++++----
1 file changed, 30 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs')
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 27b0cba..9bd55e1 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -19,7 +19,7 @@ namespace OpenSim.Region.Environment.Scenes
public event AgentCrossing OnAvatarCrossingIntoRegion;
public event ExpectUserDelegate OnExpectUser;
-
+ public event CloseAgentConnection OnCloseAgentConnection;
public SceneCommunicationService(CommunicationsManager commsMan)
{
@@ -34,6 +34,7 @@ namespace OpenSim.Region.Environment.Scenes
{
regionCommsHost.OnExpectUser += NewUserConnection;
regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
+ regionCommsHost.OnCloseAgentConnection += CloseConnection;
}
}
@@ -41,6 +42,7 @@ namespace OpenSim.Region.Environment.Scenes
{
regionCommsHost.OnExpectUser -= NewUserConnection;
regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
+ regionCommsHost.OnCloseAgentConnection -= CloseConnection;
//regionCommsHost.RemoveRegion(m_regionInfo); //TODO add to method to commsManager
regionCommsHost = null;
}
@@ -51,7 +53,7 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
+ protected void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
{
if (OnExpectUser != null)
{
@@ -59,13 +61,21 @@ namespace OpenSim.Region.Environment.Scenes
}
}
- public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
+ protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
if (OnAvatarCrossingIntoRegion != null)
{
OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying);
}
}
+
+ protected void CloseConnection(ulong regionHandle, LLUUID agentID)
+ {
+ if (OnCloseAgentConnection != null)
+ {
+ OnCloseAgentConnection(regionHandle, agentID);
+ }
+ }
#endregion
#region Inform Client of Neighbours
@@ -105,7 +115,7 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void InformClientOfNeighbours(ScenePresence avatar)
+ public void EnableNeighbourChildAgents(ScenePresence avatar)
{
List neighbours =
m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
@@ -160,7 +170,7 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public virtual void RequestTeleportLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position,
+ public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position,
LLVector3 lookAt, uint flags)
{
if (regionHandle == m_regionInfo.RegionHandle)
@@ -189,6 +199,14 @@ namespace OpenSim.Region.Environment.Scenes
string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId);
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath);
avatar.MakeChildAgent();
+ uint newRegionX = (uint)(regionHandle >> 40);
+ uint newRegionY = (((uint)(regionHandle)) >> 8);
+ uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40);
+ uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8);
+ if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3)
+ {
+ CloseChildAgentConnections(avatar);
+ }
}
}
}
@@ -199,14 +217,19 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying)
+ public bool CrossToNeighbouringRegion(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying);
}
public void CloseChildAgentConnections(ScenePresence presence)
{
-
+ foreach (ulong regionHandle in presence.KnownChildRegions)
+ {
+
+ m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, presence.ControllingClient.AgentId);
+ presence.RemoveNeighbourRegion(regionHandle);
+ }
}
}
}
--
cgit v1.1