diff options
author | MW | 2007-11-05 13:58:44 +0000 |
---|---|---|
committer | MW | 2007-11-05 13:58:44 +0000 |
commit | 73fbacea1fe18873fab175d82189a1becb0f8e10 (patch) | |
tree | 4078f63bb77e7a512a7069b209ca5be569882b52 /OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |
parent | prim cuts in ODE (diff) | |
download | opensim-SC-73fbacea1fe18873fab175d82189a1becb0f8e10.zip opensim-SC-73fbacea1fe18873fab175d82189a1becb0f8e10.tar.gz opensim-SC-73fbacea1fe18873fab175d82189a1becb0f8e10.tar.bz2 opensim-SC-73fbacea1fe18873fab175d82189a1becb0f8e10.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | 37 |
1 files changed, 30 insertions, 7 deletions
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 | |||
19 | 19 | ||
20 | public event AgentCrossing OnAvatarCrossingIntoRegion; | 20 | public event AgentCrossing OnAvatarCrossingIntoRegion; |
21 | public event ExpectUserDelegate OnExpectUser; | 21 | public event ExpectUserDelegate OnExpectUser; |
22 | 22 | public event CloseAgentConnection OnCloseAgentConnection; | |
23 | 23 | ||
24 | public SceneCommunicationService(CommunicationsManager commsMan) | 24 | public SceneCommunicationService(CommunicationsManager commsMan) |
25 | { | 25 | { |
@@ -34,6 +34,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
34 | { | 34 | { |
35 | regionCommsHost.OnExpectUser += NewUserConnection; | 35 | regionCommsHost.OnExpectUser += NewUserConnection; |
36 | regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing; | 36 | regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing; |
37 | regionCommsHost.OnCloseAgentConnection += CloseConnection; | ||
37 | } | 38 | } |
38 | } | 39 | } |
39 | 40 | ||
@@ -41,6 +42,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
41 | { | 42 | { |
42 | regionCommsHost.OnExpectUser -= NewUserConnection; | 43 | regionCommsHost.OnExpectUser -= NewUserConnection; |
43 | regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing; | 44 | regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing; |
45 | regionCommsHost.OnCloseAgentConnection -= CloseConnection; | ||
44 | //regionCommsHost.RemoveRegion(m_regionInfo); //TODO add to method to commsManager | 46 | //regionCommsHost.RemoveRegion(m_regionInfo); //TODO add to method to commsManager |
45 | regionCommsHost = null; | 47 | regionCommsHost = null; |
46 | } | 48 | } |
@@ -51,7 +53,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
51 | /// </summary> | 53 | /// </summary> |
52 | /// <param name="regionHandle"></param> | 54 | /// <param name="regionHandle"></param> |
53 | /// <param name="agent"></param> | 55 | /// <param name="agent"></param> |
54 | public void NewUserConnection(ulong regionHandle, AgentCircuitData agent) | 56 | protected void NewUserConnection(ulong regionHandle, AgentCircuitData agent) |
55 | { | 57 | { |
56 | if (OnExpectUser != null) | 58 | if (OnExpectUser != null) |
57 | { | 59 | { |
@@ -59,13 +61,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
59 | } | 61 | } |
60 | } | 62 | } |
61 | 63 | ||
62 | public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) | 64 | protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
63 | { | 65 | { |
64 | if (OnAvatarCrossingIntoRegion != null) | 66 | if (OnAvatarCrossingIntoRegion != null) |
65 | { | 67 | { |
66 | OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying); | 68 | OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying); |
67 | } | 69 | } |
68 | } | 70 | } |
71 | |||
72 | protected void CloseConnection(ulong regionHandle, LLUUID agentID) | ||
73 | { | ||
74 | if (OnCloseAgentConnection != null) | ||
75 | { | ||
76 | OnCloseAgentConnection(regionHandle, agentID); | ||
77 | } | ||
78 | } | ||
69 | #endregion | 79 | #endregion |
70 | 80 | ||
71 | #region Inform Client of Neighbours | 81 | #region Inform Client of Neighbours |
@@ -105,7 +115,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
105 | /// <summary> | 115 | /// <summary> |
106 | /// | 116 | /// |
107 | /// </summary> | 117 | /// </summary> |
108 | public void InformClientOfNeighbours(ScenePresence avatar) | 118 | public void EnableNeighbourChildAgents(ScenePresence avatar) |
109 | { | 119 | { |
110 | List<SimpleRegionInfo> neighbours = | 120 | List<SimpleRegionInfo> neighbours = |
111 | m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | 121 | m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); |
@@ -160,7 +170,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
160 | /// <param name="position"></param> | 170 | /// <param name="position"></param> |
161 | /// <param name="lookAt"></param> | 171 | /// <param name="lookAt"></param> |
162 | /// <param name="flags"></param> | 172 | /// <param name="flags"></param> |
163 | public virtual void RequestTeleportLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position, | 173 | public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position, |
164 | LLVector3 lookAt, uint flags) | 174 | LLVector3 lookAt, uint flags) |
165 | { | 175 | { |
166 | if (regionHandle == m_regionInfo.RegionHandle) | 176 | if (regionHandle == m_regionInfo.RegionHandle) |
@@ -189,6 +199,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
189 | string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId); | 199 | string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId); |
190 | avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath); | 200 | avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath); |
191 | avatar.MakeChildAgent(); | 201 | avatar.MakeChildAgent(); |
202 | uint newRegionX = (uint)(regionHandle >> 40); | ||
203 | uint newRegionY = (((uint)(regionHandle)) >> 8); | ||
204 | uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); | ||
205 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); | ||
206 | if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) | ||
207 | { | ||
208 | CloseChildAgentConnections(avatar); | ||
209 | } | ||
192 | } | 210 | } |
193 | } | 211 | } |
194 | } | 212 | } |
@@ -199,14 +217,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
199 | /// <param name="regionhandle"></param> | 217 | /// <param name="regionhandle"></param> |
200 | /// <param name="agentID"></param> | 218 | /// <param name="agentID"></param> |
201 | /// <param name="position"></param> | 219 | /// <param name="position"></param> |
202 | public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying) | 220 | public bool CrossToNeighbouringRegion(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying) |
203 | { | 221 | { |
204 | return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying); | 222 | return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying); |
205 | } | 223 | } |
206 | 224 | ||
207 | public void CloseChildAgentConnections(ScenePresence presence) | 225 | public void CloseChildAgentConnections(ScenePresence presence) |
208 | { | 226 | { |
209 | 227 | foreach (ulong regionHandle in presence.KnownChildRegions) | |
228 | { | ||
229 | |||
230 | m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, presence.ControllingClient.AgentId); | ||
231 | presence.RemoveNeighbourRegion(regionHandle); | ||
232 | } | ||
210 | } | 233 | } |
211 | } | 234 | } |
212 | } | 235 | } |