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.afrisby
parent
fdb57b28b1
commit
73fbacea1f
|
@ -38,6 +38,8 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID);
|
public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID);
|
||||||
|
|
||||||
|
public delegate void CloseAgentConnection(ulong regionHandle, LLUUID agentID);
|
||||||
|
|
||||||
public interface IRegionCommsListener
|
public interface IRegionCommsListener
|
||||||
{
|
{
|
||||||
event ExpectUserDelegate OnExpectUser;
|
event ExpectUserDelegate OnExpectUser;
|
||||||
|
@ -45,5 +47,6 @@ namespace OpenSim.Framework
|
||||||
event AgentCrossing OnAvatarCrossingIntoRegion;
|
event AgentCrossing OnAvatarCrossingIntoRegion;
|
||||||
event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
|
event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
|
||||||
event UpdateNeighbours OnNeighboursUpdate;
|
event UpdateNeighbours OnNeighboursUpdate;
|
||||||
|
event CloseAgentConnection OnCloseAgentConnection;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -38,6 +38,7 @@ namespace OpenSim.Framework
|
||||||
public event AgentCrossing OnAvatarCrossingIntoRegion;
|
public event AgentCrossing OnAvatarCrossingIntoRegion;
|
||||||
public event UpdateNeighbours OnNeighboursUpdate;
|
public event UpdateNeighbours OnNeighboursUpdate;
|
||||||
public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
|
public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
|
||||||
|
public event CloseAgentConnection OnCloseAgentConnection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -76,6 +77,14 @@ namespace OpenSim.Framework
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void TriggerCloseAgentConnection(ulong regionHandle, LLUUID agentID)
|
||||||
|
{
|
||||||
|
if (OnCloseAgentConnection != null)
|
||||||
|
{
|
||||||
|
OnCloseAgentConnection(regionHandle, agentID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -182,7 +182,7 @@ namespace OpenSim.Region.Communications.Local
|
||||||
{
|
{
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
{
|
{
|
||||||
// m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
|
m_regionListeners[regionHandle].TriggerCloseAgentConnection(regionHandle, agentID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,16 +180,18 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
foreach (Scene m_scene in m_scenes)
|
foreach (Scene m_scene in m_scenes)
|
||||||
{
|
{
|
||||||
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
|
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
|
||||||
|
{
|
||||||
|
if (!presence.IsChildAgent)
|
||||||
{
|
{
|
||||||
int dis = -100000;
|
int dis = -100000;
|
||||||
|
|
||||||
LLVector3 avatarRegionPos = presence.AbsolutePosition +
|
LLVector3 avatarRegionPos = presence.AbsolutePosition +
|
||||||
new LLVector3(
|
new LLVector3(
|
||||||
scene.RegionInfo.RegionLocX*256,
|
scene.RegionInfo.RegionLocX * 256,
|
||||||
scene.RegionInfo.RegionLocY*256,
|
scene.RegionInfo.RegionLocY * 256,
|
||||||
0);
|
0);
|
||||||
dis =
|
dis =
|
||||||
Math.Abs((int) avatarRegionPos.GetDistanceTo(fromRegionPos));
|
Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos));
|
||||||
|
|
||||||
switch (e.Type)
|
switch (e.Type)
|
||||||
{
|
{
|
||||||
|
@ -236,6 +238,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -816,6 +816,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_sceneGridService.RegisterRegion(m_regInfo);
|
m_sceneGridService.RegisterRegion(m_regInfo);
|
||||||
m_sceneGridService.OnExpectUser += NewUserConnection;
|
m_sceneGridService.OnExpectUser += NewUserConnection;
|
||||||
m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
|
m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
|
||||||
|
m_sceneGridService.OnCloseAgentConnection += CloseConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -864,13 +865,26 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CloseConnection(ulong regionHandle, LLUUID agentID)
|
||||||
|
{
|
||||||
|
if (regionHandle == m_regionHandle)
|
||||||
|
{
|
||||||
|
ScenePresence presence = m_innerScene.GetScenePresence(agentID);
|
||||||
|
if(presence != null)
|
||||||
|
{
|
||||||
|
libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket();
|
||||||
|
presence.ControllingClient.OutPacket(disable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void InformClientOfNeighbours(ScenePresence presence)
|
public void InformClientOfNeighbours(ScenePresence presence)
|
||||||
{
|
{
|
||||||
m_sceneGridService.InformClientOfNeighbours(presence);
|
m_sceneGridService.EnableNeighbourChildAgents(presence);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -908,7 +922,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
if (m_scenePresences.ContainsKey(remoteClient.AgentId))
|
if (m_scenePresences.ContainsKey(remoteClient.AgentId))
|
||||||
{
|
{
|
||||||
m_sceneGridService.RequestTeleportLocation(m_scenePresences[remoteClient.AgentId], regionHandle, position, lookAt, flags);
|
m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle, position, lookAt, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,7 +934,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="position"></param>
|
/// <param name="position"></param>
|
||||||
public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying)
|
public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying)
|
||||||
{
|
{
|
||||||
return m_sceneGridService.InformNeighbourOfCrossing(regionhandle, agentID, position, isFlying);
|
return m_sceneGridService.CrossToNeighbouringRegion(regionhandle, agentID, position, isFlying);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public event AgentCrossing OnAvatarCrossingIntoRegion;
|
public event AgentCrossing OnAvatarCrossingIntoRegion;
|
||||||
public event ExpectUserDelegate OnExpectUser;
|
public event ExpectUserDelegate OnExpectUser;
|
||||||
|
public event CloseAgentConnection OnCloseAgentConnection;
|
||||||
|
|
||||||
public SceneCommunicationService(CommunicationsManager commsMan)
|
public SceneCommunicationService(CommunicationsManager commsMan)
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
regionCommsHost.OnExpectUser += NewUserConnection;
|
regionCommsHost.OnExpectUser += NewUserConnection;
|
||||||
regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
|
regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
|
||||||
|
regionCommsHost.OnCloseAgentConnection += CloseConnection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
regionCommsHost.OnExpectUser -= NewUserConnection;
|
regionCommsHost.OnExpectUser -= NewUserConnection;
|
||||||
regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
|
regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
|
||||||
|
regionCommsHost.OnCloseAgentConnection -= CloseConnection;
|
||||||
//regionCommsHost.RemoveRegion(m_regionInfo); //TODO add to method to commsManager
|
//regionCommsHost.RemoveRegion(m_regionInfo); //TODO add to method to commsManager
|
||||||
regionCommsHost = null;
|
regionCommsHost = null;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +53,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="regionHandle"></param>
|
/// <param name="regionHandle"></param>
|
||||||
/// <param name="agent"></param>
|
/// <param name="agent"></param>
|
||||||
public void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
|
protected void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
|
||||||
{
|
{
|
||||||
if (OnExpectUser != null)
|
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)
|
if (OnAvatarCrossingIntoRegion != null)
|
||||||
{
|
{
|
||||||
OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying);
|
OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void CloseConnection(ulong regionHandle, LLUUID agentID)
|
||||||
|
{
|
||||||
|
if (OnCloseAgentConnection != null)
|
||||||
|
{
|
||||||
|
OnCloseAgentConnection(regionHandle, agentID);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Inform Client of Neighbours
|
#region Inform Client of Neighbours
|
||||||
|
@ -105,7 +115,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void InformClientOfNeighbours(ScenePresence avatar)
|
public void EnableNeighbourChildAgents(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
List<SimpleRegionInfo> neighbours =
|
List<SimpleRegionInfo> neighbours =
|
||||||
m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
|
m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
|
||||||
|
@ -160,7 +170,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="position"></param>
|
/// <param name="position"></param>
|
||||||
/// <param name="lookAt"></param>
|
/// <param name="lookAt"></param>
|
||||||
/// <param name="flags"></param>
|
/// <param name="flags"></param>
|
||||||
public virtual void RequestTeleportLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position,
|
public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position,
|
||||||
LLVector3 lookAt, uint flags)
|
LLVector3 lookAt, uint flags)
|
||||||
{
|
{
|
||||||
if (regionHandle == m_regionInfo.RegionHandle)
|
if (regionHandle == m_regionInfo.RegionHandle)
|
||||||
|
@ -189,6 +199,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId);
|
string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId);
|
||||||
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath);
|
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath);
|
||||||
avatar.MakeChildAgent();
|
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
|
||||||
/// <param name="regionhandle"></param>
|
/// <param name="regionhandle"></param>
|
||||||
/// <param name="agentID"></param>
|
/// <param name="agentID"></param>
|
||||||
/// <param name="position"></param>
|
/// <param name="position"></param>
|
||||||
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);
|
return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CloseChildAgentConnections(ScenePresence presence)
|
public void CloseChildAgentConnections(ScenePresence presence)
|
||||||
|
{
|
||||||
|
foreach (ulong regionHandle in presence.KnownChildRegions)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, presence.ControllingClient.AgentId);
|
||||||
|
presence.RemoveNeighbourRegion(regionHandle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,6 +232,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
set { m_parentID = value; }
|
set { m_parentID = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ulong> KnownChildRegions
|
||||||
|
{
|
||||||
|
get { return m_KnownChildRegions; }
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructor(s)
|
#region Constructor(s)
|
||||||
|
@ -411,6 +415,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveNeighbourRegion(ulong regionHandle)
|
||||||
|
{
|
||||||
|
if (!m_KnownChildRegions.Contains(regionHandle))
|
||||||
|
{
|
||||||
|
m_KnownChildRegions.Remove(regionHandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Event Handlers
|
#region Event Handlers
|
||||||
|
@ -1090,9 +1101,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void SetWearable(int wearableId, AvatarWearable wearable)
|
public void SetWearable(int wearableId, AvatarWearable wearable)
|
||||||
{
|
{
|
||||||
m_wearables[wearableId] = wearable;
|
m_wearables[wearableId] = wearable;
|
||||||
m_controllingClient.SendWearables(m_wearables, m_wearablesSerial++);
|
m_controllingClient.SendWearables(m_wearables, ++m_wearablesSerial);
|
||||||
SendOurAppearance( m_controllingClient );
|
//m_controllingClient.SendWearables(m_wearables, m_wearablesSerial++);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@ using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Scenes
|
namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
public class SceneXmlLoader //Most likely can move to a module
|
public class SceneXmlLoader // can move to a module?
|
||||||
{
|
{
|
||||||
protected InnerScene m_innerScene;
|
protected InnerScene m_innerScene;
|
||||||
protected RegionInfo m_regInfo;
|
protected RegionInfo m_regInfo;
|
||||||
|
|
Loading…
Reference in New Issue