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 CloseAgentConnection(ulong regionHandle, LLUUID agentID);
|
||||
|
||||
public interface IRegionCommsListener
|
||||
{
|
||||
event ExpectUserDelegate OnExpectUser;
|
||||
|
@ -45,5 +47,6 @@ namespace OpenSim.Framework
|
|||
event AgentCrossing OnAvatarCrossingIntoRegion;
|
||||
event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
|
||||
event UpdateNeighbours OnNeighboursUpdate;
|
||||
event CloseAgentConnection OnCloseAgentConnection;
|
||||
}
|
||||
}
|
|
@ -38,6 +38,7 @@ namespace OpenSim.Framework
|
|||
public event AgentCrossing OnAvatarCrossingIntoRegion;
|
||||
public event UpdateNeighbours OnNeighboursUpdate;
|
||||
public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
|
||||
public event CloseAgentConnection OnCloseAgentConnection;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
@ -76,6 +77,14 @@ namespace OpenSim.Framework
|
|||
return false;
|
||||
}
|
||||
|
||||
public virtual void TriggerCloseAgentConnection(ulong regionHandle, LLUUID agentID)
|
||||
{
|
||||
if (OnCloseAgentConnection != null)
|
||||
{
|
||||
OnCloseAgentConnection(regionHandle, agentID);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -182,7 +182,7 @@ namespace OpenSim.Region.Communications.Local
|
|||
{
|
||||
if (m_regionListeners.ContainsKey(regionHandle))
|
||||
{
|
||||
// m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
|
||||
m_regionListeners[regionHandle].TriggerCloseAgentConnection(regionHandle, agentID);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -181,60 +181,63 @@ namespace OpenSim.Region.Environment.Modules
|
|||
{
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
int dis = -100000;
|
||||
|
||||
LLVector3 avatarRegionPos = presence.AbsolutePosition +
|
||||
new LLVector3(
|
||||
scene.RegionInfo.RegionLocX*256,
|
||||
scene.RegionInfo.RegionLocY*256,
|
||||
0);
|
||||
dis =
|
||||
Math.Abs((int) avatarRegionPos.GetDistanceTo(fromRegionPos));
|
||||
|
||||
switch (e.Type)
|
||||
if (!presence.IsChildAgent)
|
||||
{
|
||||
case ChatTypeEnum.Whisper:
|
||||
if (dis < m_whisperdistance)
|
||||
{
|
||||
//should change so the message is sent through the avatar rather than direct to the ClientView
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
case ChatTypeEnum.Say:
|
||||
if (dis < m_saydistance)
|
||||
{
|
||||
//Console.WriteLine("sending chat");
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
case ChatTypeEnum.Shout:
|
||||
if (dis < m_shoutdistance)
|
||||
{
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
int dis = -100000;
|
||||
|
||||
case ChatTypeEnum.Broadcast:
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
LLVector3 avatarRegionPos = presence.AbsolutePosition +
|
||||
new LLVector3(
|
||||
scene.RegionInfo.RegionLocX * 256,
|
||||
scene.RegionInfo.RegionLocY * 256,
|
||||
0);
|
||||
dis =
|
||||
Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos));
|
||||
|
||||
switch (e.Type)
|
||||
{
|
||||
case ChatTypeEnum.Whisper:
|
||||
if (dis < m_whisperdistance)
|
||||
{
|
||||
//should change so the message is sent through the avatar rather than direct to the ClientView
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
case ChatTypeEnum.Say:
|
||||
if (dis < m_saydistance)
|
||||
{
|
||||
//Console.WriteLine("sending chat");
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
case ChatTypeEnum.Shout:
|
||||
if (dis < m_shoutdistance)
|
||||
{
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
|
||||
case ChatTypeEnum.Broadcast:
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -816,6 +816,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_sceneGridService.RegisterRegion(m_regInfo);
|
||||
m_sceneGridService.OnExpectUser += NewUserConnection;
|
||||
m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
|
||||
m_sceneGridService.OnCloseAgentConnection += CloseConnection;
|
||||
}
|
||||
|
||||
/// <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>
|
||||
public void InformClientOfNeighbours(ScenePresence presence)
|
||||
{
|
||||
m_sceneGridService.InformClientOfNeighbours(presence);
|
||||
m_sceneGridService.EnableNeighbourChildAgents(presence);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -908,7 +922,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
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>
|
||||
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
|
||||
|
|
|
@ -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
|
|||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="agent"></param>
|
||||
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
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void InformClientOfNeighbours(ScenePresence avatar)
|
||||
public void EnableNeighbourChildAgents(ScenePresence avatar)
|
||||
{
|
||||
List<SimpleRegionInfo> neighbours =
|
||||
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="lookAt"></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)
|
||||
{
|
||||
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
|
|||
/// <param name="regionhandle"></param>
|
||||
/// <param name="agentID"></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);
|
||||
}
|
||||
|
||||
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; }
|
||||
}
|
||||
|
||||
public List<ulong> KnownChildRegions
|
||||
{
|
||||
get { return m_KnownChildRegions; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#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
|
||||
|
||||
#region Event Handlers
|
||||
|
@ -1090,9 +1101,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public void SetWearable(int wearableId, AvatarWearable wearable)
|
||||
{
|
||||
m_wearables[wearableId] = wearable;
|
||||
m_controllingClient.SendWearables(m_wearables, m_wearablesSerial++);
|
||||
SendOurAppearance( m_controllingClient );
|
||||
|
||||
m_controllingClient.SendWearables(m_wearables, ++m_wearablesSerial);
|
||||
//m_controllingClient.SendWearables(m_wearables, m_wearablesSerial++);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ using OpenSim.Region.Physics.Manager;
|
|||
|
||||
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 RegionInfo m_regInfo;
|
||||
|
|
Loading…
Reference in New Issue