diff options
author | Teravus Ovares | 2008-01-21 23:04:42 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-01-21 23:04:42 +0000 |
commit | 3fe6b2280d0b335ef8d9f2b0dc3406a47e6c0b53 (patch) | |
tree | bb8cbf0b5918448c92f6b0f42fec5013450d7e25 /OpenSim | |
parent | Another attempt to squash the animation bug. Wish I could get this to fail at... (diff) | |
download | opensim-SC-3fe6b2280d0b335ef8d9f2b0dc3406a47e6c0b53.zip opensim-SC-3fe6b2280d0b335ef8d9f2b0dc3406a47e6c0b53.tar.gz opensim-SC-3fe6b2280d0b335ef8d9f2b0dc3406a47e6c0b53.tar.bz2 opensim-SC-3fe6b2280d0b335ef8d9f2b0dc3406a47e6c0b53.tar.xz |
* Shutting down child agents properly in neighbor regions.
Diffstat (limited to 'OpenSim')
9 files changed, 183 insertions, 26 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index baf24f0..dd7c168 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -175,6 +175,7 @@ namespace OpenSim.Framework.Communications | |||
175 | public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz) | 175 | public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz) |
176 | { | 176 | { |
177 | m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); | 177 | m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); |
178 | |||
178 | } | 179 | } |
179 | 180 | ||
180 | /// <summary> | 181 | /// <summary> |
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs index 13ae21f..e93719e 100644 --- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs +++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs | |||
@@ -45,6 +45,6 @@ namespace OpenSim.Framework.Communications | |||
45 | bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId); | 45 | bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId); |
46 | bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primID); | 46 | bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primID); |
47 | 47 | ||
48 | void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID); | 48 | bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID); |
49 | } | 49 | } |
50 | } \ No newline at end of file | 50 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs index 19608c8..c8fc9c5 100644 --- a/OpenSim/Framework/IRegionCommsListener.cs +++ b/OpenSim/Framework/IRegionCommsListener.cs | |||
@@ -44,12 +44,14 @@ namespace OpenSim.Framework | |||
44 | 44 | ||
45 | public delegate void AcknowledgePrimCross(ulong regionHandle, LLUUID PrimID); | 45 | public delegate void AcknowledgePrimCross(ulong regionHandle, LLUUID PrimID); |
46 | 46 | ||
47 | public delegate void CloseAgentConnection(ulong regionHandle, LLUUID agentID); | 47 | public delegate bool CloseAgentConnection(ulong regionHandle, LLUUID agentID); |
48 | 48 | ||
49 | public delegate bool RegionUp(RegionInfo region); | 49 | public delegate bool RegionUp(RegionInfo region); |
50 | 50 | ||
51 | public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData); | 51 | public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData); |
52 | 52 | ||
53 | |||
54 | |||
53 | 55 | ||
54 | public interface IRegionCommsListener | 56 | public interface IRegionCommsListener |
55 | { | 57 | { |
@@ -64,5 +66,6 @@ namespace OpenSim.Framework | |||
64 | event CloseAgentConnection OnCloseAgentConnection; | 66 | event CloseAgentConnection OnCloseAgentConnection; |
65 | event RegionUp OnRegionUp; | 67 | event RegionUp OnRegionUp; |
66 | event ChildAgentUpdate OnChildAgentUpdate; | 68 | event ChildAgentUpdate OnChildAgentUpdate; |
69 | |||
67 | } | 70 | } |
68 | } \ No newline at end of file | 71 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs index 1db5aae..c12c3df 100644 --- a/OpenSim/Framework/RegionCommsListener.cs +++ b/OpenSim/Framework/RegionCommsListener.cs | |||
@@ -45,6 +45,7 @@ namespace OpenSim.Framework | |||
45 | public event CloseAgentConnection OnCloseAgentConnection; | 45 | public event CloseAgentConnection OnCloseAgentConnection; |
46 | public event RegionUp OnRegionUp; | 46 | public event RegionUp OnRegionUp; |
47 | public event ChildAgentUpdate OnChildAgentUpdate; | 47 | public event ChildAgentUpdate OnChildAgentUpdate; |
48 | |||
48 | 49 | ||
49 | 50 | ||
50 | public string debugRegionName = String.Empty; | 51 | public string debugRegionName = String.Empty; |
@@ -139,12 +140,15 @@ namespace OpenSim.Framework | |||
139 | return false; | 140 | return false; |
140 | } | 141 | } |
141 | 142 | ||
142 | public virtual void TriggerCloseAgentConnection(ulong regionHandle, LLUUID agentID) | 143 | public virtual bool TriggerCloseAgentConnection(ulong regionHandle, LLUUID agentID) |
143 | { | 144 | { |
144 | if (OnCloseAgentConnection != null) | 145 | if (OnCloseAgentConnection != null) |
145 | { | 146 | { |
146 | OnCloseAgentConnection(regionHandle, agentID); | 147 | OnCloseAgentConnection(regionHandle, agentID); |
148 | return true; | ||
149 | |||
147 | } | 150 | } |
151 | return false; | ||
148 | } | 152 | } |
149 | 153 | ||
150 | /// <summary> | 154 | /// <summary> |
@@ -179,5 +183,13 @@ namespace OpenSim.Framework | |||
179 | 183 | ||
180 | return false; | 184 | return false; |
181 | } | 185 | } |
186 | |||
187 | public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) | ||
188 | { | ||
189 | if (OnCloseAgentConnection != null) | ||
190 | return OnCloseAgentConnection(regionHandle, agentID); | ||
191 | |||
192 | return false; | ||
193 | } | ||
182 | } | 194 | } |
183 | } \ No newline at end of file | 195 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 5b16e5a..25452c1 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs | |||
@@ -203,7 +203,14 @@ namespace OpenSim.Region.Communications.Local | |||
203 | } | 203 | } |
204 | return mapBlocks; | 204 | return mapBlocks; |
205 | } | 205 | } |
206 | 206 | public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) | |
207 | { | ||
208 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
209 | { | ||
210 | return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(regionHandle, agentID); | ||
211 | } | ||
212 | return false; | ||
213 | } | ||
207 | 214 | ||
208 | public virtual bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) | 215 | public virtual bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) |
209 | { | 216 | { |
@@ -267,6 +274,14 @@ namespace OpenSim.Region.Communications.Local | |||
267 | return false; | 274 | return false; |
268 | } | 275 | } |
269 | 276 | ||
277 | public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) | ||
278 | { | ||
279 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
280 | { | ||
281 | return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(regionHandle, agentID); | ||
282 | } | ||
283 | return false; | ||
284 | } | ||
270 | /// <summary> | 285 | /// <summary> |
271 | /// </summary> | 286 | /// </summary> |
272 | /// <param name="regionHandle"></param> | 287 | /// <param name="regionHandle"></param> |
@@ -328,13 +343,7 @@ namespace OpenSim.Region.Communications.Local | |||
328 | return false; | 343 | return false; |
329 | } | 344 | } |
330 | 345 | ||
331 | public void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) | 346 | |
332 | { | ||
333 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
334 | { | ||
335 | m_regionListeners[regionHandle].TriggerCloseAgentConnection(regionHandle, agentID); | ||
336 | } | ||
337 | } | ||
338 | 347 | ||
339 | public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId) | 348 | public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId) |
340 | { | 349 | { |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 2ca9022..683fbfb 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -491,7 +491,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
491 | InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; | 491 | InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; |
492 | InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; | 492 | InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; |
493 | InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate; | 493 | InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate; |
494 | //InterRegionSingleton.Instance.OnRegionUp += RegionUp; | 494 | InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection; |
495 | |||
495 | } | 496 | } |
496 | 497 | ||
497 | #region Methods called by regions in this instance | 498 | #region Methods called by regions in this instance |
@@ -959,8 +960,53 @@ namespace OpenSim.Region.Communications.OGS1 | |||
959 | } | 960 | } |
960 | } | 961 | } |
961 | 962 | ||
962 | public void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) | 963 | public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) |
963 | { | 964 | { |
965 | RegionInfo regInfo = null; | ||
966 | try | ||
967 | { | ||
968 | if (m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID)) | ||
969 | { | ||
970 | return true; | ||
971 | } | ||
972 | |||
973 | regInfo = RequestNeighbourInfo(regionHandle); | ||
974 | if (regInfo != null) | ||
975 | { | ||
976 | bool retValue = false; | ||
977 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
978 | typeof(OGS1InterRegionRemoting), | ||
979 | "tcp://" + regInfo.RemotingAddress + | ||
980 | ":" + regInfo.RemotingPort + | ||
981 | "/InterRegions"); | ||
982 | if (remObject != null) | ||
983 | { | ||
984 | retValue = | ||
985 | remObject.TellRegionToCloseChildConnection(regionHandle, agentID.UUID); | ||
986 | } | ||
987 | else | ||
988 | { | ||
989 | Console.WriteLine("remoting object not found"); | ||
990 | } | ||
991 | remObject = null; | ||
992 | |||
993 | return true; | ||
994 | } | ||
995 | //TODO need to see if we know about where this region is and use .net remoting | ||
996 | // to inform it. | ||
997 | return false; | ||
998 | } | ||
999 | catch (RemotingException e) | ||
1000 | { | ||
1001 | MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName + | ||
1002 | " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
1003 | //MainLog.Instance.Debug(e.ToString()); | ||
1004 | return false; | ||
1005 | } | ||
1006 | catch | ||
1007 | { | ||
1008 | return false; | ||
1009 | } | ||
964 | } | 1010 | } |
965 | 1011 | ||
966 | public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId) | 1012 | public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId) |
@@ -1086,6 +1132,20 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1086 | } | 1132 | } |
1087 | } | 1133 | } |
1088 | 1134 | ||
1135 | public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) | ||
1136 | { | ||
1137 | try | ||
1138 | { | ||
1139 | return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID); | ||
1140 | } | ||
1141 | catch (RemotingException) | ||
1142 | { | ||
1143 | MainLog.Instance.Verbose("INTERREGION", "Remoting Error: Unable to connect to neighbour to tell it to close a child connection"); | ||
1144 | return false; | ||
1145 | } | ||
1146 | |||
1147 | } | ||
1148 | |||
1089 | #endregion | 1149 | #endregion |
1090 | 1150 | ||
1091 | #endregion | 1151 | #endregion |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs index a0da07e..b39e0b7 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs | |||
@@ -45,6 +45,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
45 | 45 | ||
46 | public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate); | 46 | public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate); |
47 | 47 | ||
48 | public delegate bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID); | ||
49 | |||
48 | public sealed class InterRegionSingleton | 50 | public sealed class InterRegionSingleton |
49 | { | 51 | { |
50 | private static readonly InterRegionSingleton instance = new InterRegionSingleton(); | 52 | private static readonly InterRegionSingleton instance = new InterRegionSingleton(); |
@@ -55,6 +57,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
55 | public event PrimGroupArrival OnPrimGroupArrival; | 57 | public event PrimGroupArrival OnPrimGroupArrival; |
56 | public event RegionUp OnRegionUp; | 58 | public event RegionUp OnRegionUp; |
57 | public event ChildAgentUpdate OnChildAgentUpdate; | 59 | public event ChildAgentUpdate OnChildAgentUpdate; |
60 | public event TellRegionToCloseChildConnection OnTellRegionToCloseChildConnection; | ||
61 | |||
58 | 62 | ||
59 | 63 | ||
60 | static InterRegionSingleton() | 64 | static InterRegionSingleton() |
@@ -123,6 +127,16 @@ namespace OpenSim.Region.Communications.OGS1 | |||
123 | } | 127 | } |
124 | return false; | 128 | return false; |
125 | } | 129 | } |
130 | |||
131 | public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) | ||
132 | { | ||
133 | if (OnTellRegionToCloseChildConnection != null) | ||
134 | { | ||
135 | |||
136 | return OnTellRegionToCloseChildConnection(regionHandle, agentID); | ||
137 | } | ||
138 | return false; | ||
139 | } | ||
126 | } | 140 | } |
127 | 141 | ||
128 | public class OGS1InterRegionRemoting : MarshalByRefObject | 142 | public class OGS1InterRegionRemoting : MarshalByRefObject |
@@ -171,6 +185,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
171 | } | 185 | } |
172 | } | 186 | } |
173 | 187 | ||
188 | |||
174 | public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying) | 189 | public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying) |
175 | { | 190 | { |
176 | try | 191 | try |
@@ -215,5 +230,18 @@ namespace OpenSim.Region.Communications.OGS1 | |||
215 | return false; | 230 | return false; |
216 | } | 231 | } |
217 | } | 232 | } |
233 | public bool TellRegionToCloseChildConnection(ulong regionHandle, Guid agentID) | ||
234 | { | ||
235 | try | ||
236 | { | ||
237 | return InterRegionSingleton.Instance.TellRegionToCloseChildConnection(regionHandle, new LLUUID(agentID)); | ||
238 | |||
239 | } | ||
240 | catch (RemotingException) | ||
241 | { | ||
242 | OpenSim.Framework.Console.MainLog.Instance.Verbose("INTERREGION", "Remoting Error: Unable to connect to remote region: " + regionHandle.ToString()); | ||
243 | return false; | ||
244 | } | ||
245 | } | ||
218 | } | 246 | } |
219 | } \ No newline at end of file | 247 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2f961c1..7175d83 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1288,6 +1288,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1288 | CommsManager.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, | 1288 | CommsManager.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, |
1289 | avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, | 1289 | avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, |
1290 | avatar.AbsolutePosition.Z); | 1290 | avatar.AbsolutePosition.Z); |
1291 | m_sceneGridService.SendCloseChildAgentConnections(avatar); | ||
1291 | } | 1292 | } |
1292 | } | 1293 | } |
1293 | catch (NullReferenceException) | 1294 | catch (NullReferenceException) |
@@ -1389,6 +1390,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1389 | m_sceneGridService.OnCloseAgentConnection += CloseConnection; | 1390 | m_sceneGridService.OnCloseAgentConnection += CloseConnection; |
1390 | m_sceneGridService.OnRegionUp += OtherRegionUp; | 1391 | m_sceneGridService.OnRegionUp += OtherRegionUp; |
1391 | m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | 1392 | m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; |
1393 | |||
1392 | 1394 | ||
1393 | 1395 | ||
1394 | m_sceneGridService.KillObject = SendKillObject; | 1396 | m_sceneGridService.KillObject = SendKillObject; |
@@ -1509,7 +1511,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1509 | /// </summary> | 1511 | /// </summary> |
1510 | /// <param name="regionHandle"></param> | 1512 | /// <param name="regionHandle"></param> |
1511 | /// <param name="agentID"></param> | 1513 | /// <param name="agentID"></param> |
1512 | public void CloseConnection(ulong regionHandle, LLUUID agentID) | 1514 | public bool CloseConnection(ulong regionHandle, LLUUID agentID) |
1513 | { | 1515 | { |
1514 | if (regionHandle == m_regionHandle) | 1516 | if (regionHandle == m_regionHandle) |
1515 | { | 1517 | { |
@@ -1527,8 +1529,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1527 | // Tell a single agent to disconnect from the region. | 1529 | // Tell a single agent to disconnect from the region. |
1528 | libsecondlife.Packets.DisableSimulatorPacket disable = (libsecondlife.Packets.DisableSimulatorPacket) PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator); | 1530 | libsecondlife.Packets.DisableSimulatorPacket disable = (libsecondlife.Packets.DisableSimulatorPacket) PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator); |
1529 | presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); | 1531 | presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); |
1532 | presence.ControllingClient.Close(true); | ||
1530 | } | 1533 | } |
1531 | } | 1534 | } |
1535 | return true; | ||
1532 | } | 1536 | } |
1533 | 1537 | ||
1534 | /// <summary> | 1538 | /// <summary> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 666edb1..a9c2c2f 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -51,6 +51,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
51 | public event PrimCrossing OnPrimCrossingIntoRegion; | 51 | public event PrimCrossing OnPrimCrossingIntoRegion; |
52 | public event RegionUp OnRegionUp; | 52 | public event RegionUp OnRegionUp; |
53 | public event ChildAgentUpdate OnChildAgentUpdate; | 53 | public event ChildAgentUpdate OnChildAgentUpdate; |
54 | |||
54 | 55 | ||
55 | 56 | ||
56 | public KillObjectDelegate KillObject; | 57 | public KillObjectDelegate KillObject; |
@@ -86,6 +87,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
86 | regionCommsHost.OnCloseAgentConnection += CloseConnection; | 87 | regionCommsHost.OnCloseAgentConnection += CloseConnection; |
87 | regionCommsHost.OnRegionUp += newRegionUp; | 88 | regionCommsHost.OnRegionUp += newRegionUp; |
88 | regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; | 89 | regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; |
90 | |||
89 | } | 91 | } |
90 | else | 92 | else |
91 | { | 93 | { |
@@ -160,12 +162,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
160 | } | 162 | } |
161 | } | 163 | } |
162 | 164 | ||
163 | protected void CloseConnection(ulong regionHandle, LLUUID agentID) | 165 | protected bool CloseConnection(ulong regionHandle, LLUUID agentID) |
164 | { | 166 | { |
167 | MainLog.Instance.Verbose("INTERREGION", "Incoming Agent Close Request for agent: " + agentID.ToString()); | ||
168 | |||
165 | if (OnCloseAgentConnection != null) | 169 | if (OnCloseAgentConnection != null) |
166 | { | 170 | { |
167 | OnCloseAgentConnection(regionHandle, agentID); | 171 | return OnCloseAgentConnection(regionHandle, agentID); |
168 | } | 172 | } |
173 | return false; | ||
169 | } | 174 | } |
170 | 175 | ||
171 | #endregion | 176 | #endregion |
@@ -366,6 +371,50 @@ namespace OpenSim.Region.Environment.Scenes | |||
366 | d); | 371 | d); |
367 | } | 372 | } |
368 | 373 | ||
374 | public delegate void SendCloseChildAgentDelegate( ScenePresence presence); | ||
375 | |||
376 | /// <summary> | ||
377 | /// This informs all neighboring regions about the settings of it's child agent. | ||
378 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | ||
379 | /// | ||
380 | /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. | ||
381 | /// | ||
382 | /// </summary> | ||
383 | private void SendCloseChildAgentAsync(ScenePresence presence) | ||
384 | { | ||
385 | |||
386 | foreach (ulong regionHandle in presence.KnownChildRegions) | ||
387 | { | ||
388 | bool regionAccepted = m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, presence.ControllingClient.AgentId); | ||
389 | |||
390 | if (regionAccepted) | ||
391 | { | ||
392 | MainLog.Instance.Notice("INTERGRID", "Completed sending agent Close agent Request to neighbor"); | ||
393 | presence.RemoveNeighbourRegion(regionHandle); | ||
394 | } | ||
395 | else | ||
396 | { | ||
397 | MainLog.Instance.Notice("INTERGRID", "Failed sending agent Close agent Request to neighbor"); | ||
398 | |||
399 | } | ||
400 | |||
401 | } | ||
402 | } | ||
403 | |||
404 | private void SendCloseChildAgentCompleted(IAsyncResult iar) | ||
405 | { | ||
406 | SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState; | ||
407 | icon.EndInvoke(iar); | ||
408 | } | ||
409 | |||
410 | public void SendCloseChildAgentConnections(ScenePresence presence) | ||
411 | { | ||
412 | // This assumes that we know what our neighbors are. | ||
413 | SendCloseChildAgentDelegate d = SendCloseChildAgentAsync; | ||
414 | d.BeginInvoke(presence, | ||
415 | SendCloseChildAgentCompleted, | ||
416 | d); | ||
417 | } | ||
369 | 418 | ||
370 | /// <summary> | 419 | /// <summary> |
371 | /// Helper function to request neighbors from grid-comms | 420 | /// Helper function to request neighbors from grid-comms |
@@ -454,7 +503,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
454 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); | 503 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); |
455 | if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) | 504 | if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) |
456 | { | 505 | { |
457 | CloseChildAgentConnections(avatar); | 506 | SendCloseChildAgentConnections(avatar); |
458 | } | 507 | } |
459 | } | 508 | } |
460 | else | 509 | else |
@@ -481,15 +530,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
481 | return m_commsProvider.InterRegion.ExpectPrimCrossing(regionhandle, primID, position, isPhysical); | 530 | return m_commsProvider.InterRegion.ExpectPrimCrossing(regionhandle, primID, position, isPhysical); |
482 | } | 531 | } |
483 | 532 | ||
484 | public void CloseChildAgentConnections(ScenePresence presence) | ||
485 | { | ||
486 | foreach (ulong regionHandle in presence.KnownChildRegions) | ||
487 | { | ||
488 | m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, | ||
489 | presence.ControllingClient.AgentId); | ||
490 | presence.RemoveNeighbourRegion(regionHandle); | ||
491 | } | ||
492 | } | ||
493 | 533 | ||
494 | public Dictionary<string, string> GetGridSettings() | 534 | public Dictionary<string, string> GetGridSettings() |
495 | { | 535 | { |