diff options
author | diva | 2008-12-15 16:23:34 +0000 |
---|---|---|
committer | diva | 2008-12-15 16:23:34 +0000 |
commit | 4b71b88114c6ac149571512c57ea005d85147f54 (patch) | |
tree | 18b638632d5a85b1670c9e1832398fa2d0dfb6e7 /OpenSim/Region/Environment/Scenes | |
parent | Update svn properties. (diff) | |
download | opensim-SC-4b71b88114c6ac149571512c57ea005d85147f54.zip opensim-SC-4b71b88114c6ac149571512c57ea005d85147f54.tar.gz opensim-SC-4b71b88114c6ac149571512c57ea005d85147f54.tar.bz2 opensim-SC-4b71b88114c6ac149571512c57ea005d85147f54.tar.xz |
Bug fix in new child agents management. Thanks DigiDaz for helping identify this issue.
We need to update all child agents whenever the root agent crosses regions. The update
now includes child agents in common neighbours. This is so that those get updated with the
seeds of the new child agents that are spawned from the receiving region.
This also fixes some timing issues. We need to close child agents from the originating region
before we update child agents in the receiving region.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
4 files changed, 174 insertions, 116 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs index 9e23831..595ac09 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs | |||
@@ -169,6 +169,17 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid | |||
169 | // once we reach here... | 169 | // once we reach here... |
170 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | 170 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); |
171 | 171 | ||
172 | // Let's close some agents | ||
173 | if (isHyperLink) // close them all except this one | ||
174 | { | ||
175 | List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles); | ||
176 | regions.Remove(avatar.Scene.RegionInfo.RegionHandle); | ||
177 | SendCloseChildAgentConnections(avatar.UUID, regions); | ||
178 | } | ||
179 | else // close just a few | ||
180 | avatar.CloseChildAgents(newRegionX, newRegionY); | ||
181 | |||
182 | string capsPath = String.Empty; | ||
172 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); | 183 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); |
173 | agent.BaseFolder = UUID.Zero; | 184 | agent.BaseFolder = UUID.Zero; |
174 | agent.InventoryFolder = UUID.Zero; | 185 | agent.InventoryFolder = UUID.Zero; |
@@ -178,38 +189,39 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid | |||
178 | { | 189 | { |
179 | // brand new agent | 190 | // brand new agent |
180 | agent.CapsPath = Util.GetRandomCapsPath(); | 191 | agent.CapsPath = Util.GetRandomCapsPath(); |
192 | if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent)) | ||
193 | { | ||
194 | avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports."); | ||
195 | return; | ||
196 | } | ||
197 | |||
198 | // TODO Should construct this behind a method | ||
199 | capsPath = | ||
200 | "http://" + reg.ExternalHostName + ":" + reg.HttpPort | ||
201 | + "/CAPS/" + agent.CapsPath + "0000/"; | ||
202 | |||
203 | if (eq != null) | ||
204 | { | ||
205 | OSD Item = EventQueueHelper.EnableSimulator(realHandle, reg.ExternalEndPoint); | ||
206 | eq.Enqueue(Item, avatar.UUID); | ||
207 | |||
208 | Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, reg.ExternalEndPoint.ToString(), capsPath); | ||
209 | eq.Enqueue(Item, avatar.UUID); | ||
210 | } | ||
211 | else | ||
212 | { | ||
213 | avatar.ControllingClient.InformClientOfNeighbour(realHandle, reg.ExternalEndPoint); | ||
214 | // TODO: make Event Queue disablable! | ||
215 | } | ||
181 | } | 216 | } |
182 | else | 217 | else |
183 | { | 218 | { |
184 | // child agent already there | 219 | // child agent already there |
185 | agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle); | 220 | agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle); |
221 | capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort | ||
222 | + "/CAPS/" + agent.CapsPath + "0000/"; | ||
186 | } | 223 | } |
187 | 224 | ||
188 | if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent)) | ||
189 | { | ||
190 | avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports."); | ||
191 | return; | ||
192 | } | ||
193 | |||
194 | // TODO Should construct this behind a method | ||
195 | string capsPath = | ||
196 | "http://" + reg.ExternalHostName + ":" + reg.HttpPort | ||
197 | + "/CAPS/" + agent.CapsPath + "0000/"; | ||
198 | |||
199 | if (eq != null) | ||
200 | { | ||
201 | OSD Item = EventQueueHelper.EnableSimulator(realHandle, reg.ExternalEndPoint); | ||
202 | eq.Enqueue(Item, avatar.UUID); | ||
203 | |||
204 | Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, reg.ExternalEndPoint.ToString(), capsPath); | ||
205 | eq.Enqueue(Item, avatar.UUID); | ||
206 | } | ||
207 | else | ||
208 | { | ||
209 | avatar.ControllingClient.InformClientOfNeighbour(realHandle, reg.ExternalEndPoint); | ||
210 | // TODO: make Event Queue disablable! | ||
211 | } | ||
212 | |||
213 | m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, | 225 | m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, |
214 | position, false); | 226 | position, false); |
215 | 227 | ||
@@ -258,28 +270,24 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid | |||
258 | } | 270 | } |
259 | 271 | ||
260 | 272 | ||
261 | // Let's close some children agents | ||
262 | if (isHyperLink) // close them all | ||
263 | SendCloseChildAgentConnections(avatar.UUID, avatar.KnownChildRegionHandles); | ||
264 | else // close just a few | ||
265 | avatar.CloseChildAgents(newRegionX, newRegionY); | ||
266 | |||
267 | //avatar.Close(); | 273 | //avatar.Close(); |
268 | 274 | ||
269 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 275 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
270 | /// | 276 | /// |
271 | /// Hypergrid mod: extra check for isHyperLink | 277 | /// Hypergrid mod: extra check for isHyperLink |
272 | /// | 278 | /// |
273 | //if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 279 | if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink) |
274 | //{ | 280 | { |
275 | // CloseConnection(avatar.UUID); | 281 | CloseConnection(avatar.UUID); |
276 | //} | 282 | } |
277 | // if (teleport success) // seems to be always success here | 283 | // if (teleport success) // seems to be always success here |
278 | // the user may change their profile information in other region, | 284 | // the user may change their profile information in other region, |
279 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 285 | // so the userinfo in UserProfileCache is not reliable any more, delete it |
280 | if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) | 286 | if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) |
287 | { | ||
281 | m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); | 288 | m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); |
282 | m_log.InfoFormat("[HGSceneCommService]: User {0} is going to another region, profile cache removed", avatar.UUID); | 289 | m_log.InfoFormat("[HGSceneCommService]: User {0} is going to another region, profile cache removed", avatar.UUID); |
290 | } | ||
283 | } | 291 | } |
284 | else | 292 | else |
285 | { | 293 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 6ce19c6..9497043 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -2657,7 +2657,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2657 | GetAvatarAppearance(client, out appearance); | 2657 | GetAvatarAppearance(client, out appearance); |
2658 | 2658 | ||
2659 | ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); | 2659 | ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); |
2660 | avatar.KnownRegions = GetChildrenSeeds(avatar.UUID); | 2660 | //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID); |
2661 | return avatar; | 2661 | return avatar; |
2662 | } | 2662 | } |
2663 | 2663 | ||
@@ -2871,9 +2871,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2871 | /// <param name="agent"></param> | 2871 | /// <param name="agent"></param> |
2872 | public void NewUserConnection(AgentCircuitData agent) | 2872 | public void NewUserConnection(AgentCircuitData agent) |
2873 | { | 2873 | { |
2874 | m_log.DebugFormat("[CONNECTION DEBUGGING] Adding NewUserConnection for {0} in {1} with CC of {2}", agent.AgentID, | ||
2875 | RegionInfo.RegionName, agent.circuitcode); | ||
2876 | |||
2877 | if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) | 2874 | if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) |
2878 | { | 2875 | { |
2879 | m_log.WarnFormat( | 2876 | m_log.WarnFormat( |
@@ -2883,9 +2880,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
2883 | 2880 | ||
2884 | /// Diva: Horrible stuff! | 2881 | /// Diva: Horrible stuff! |
2885 | capsPaths[agent.AgentID] = agent.CapsPath; | 2882 | capsPaths[agent.AgentID] = agent.CapsPath; |
2886 | //m_log.DebugFormat("------------>child seeds in {0}: {1}", RegionInfo.RegionName, ((agent.ChildrenCapSeeds == null) ? "null" : agent.ChildrenCapSeeds.Count.ToString())); | ||
2887 | childrenSeeds[agent.AgentID] = ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds); | 2883 | childrenSeeds[agent.AgentID] = ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds); |
2888 | 2884 | ||
2885 | ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); | ||
2886 | if (sp != null) | ||
2887 | { | ||
2888 | m_log.DebugFormat("[CONNECTION DEBUGGING]: Updated agent {0} in {1}", agent.AgentID, RegionInfo.RegionName); | ||
2889 | sp.AdjustKnownSeeds(); | ||
2890 | return; | ||
2891 | } | ||
2892 | |||
2893 | m_log.DebugFormat("[CONNECTION DEBUGGING]: Adding NewUserConnection for {0} in {1} with CC of {2}", agent.AgentID, | ||
2894 | RegionInfo.RegionName, agent.circuitcode); | ||
2895 | |||
2889 | AddCapsHandler(agent.AgentID); | 2896 | AddCapsHandler(agent.AgentID); |
2890 | 2897 | ||
2891 | if (!agent.child) | 2898 | if (!agent.child) |
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index b89f753..10b0759 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -255,7 +255,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
255 | #region Inform Client of Neighbours | 255 | #region Inform Client of Neighbours |
256 | 256 | ||
257 | private delegate void InformClientOfNeighbourDelegate( | 257 | private delegate void InformClientOfNeighbourDelegate( |
258 | ScenePresence avatar, AgentCircuitData a, SimpleRegionInfo reg, IPEndPoint endPoint); | 258 | ScenePresence avatar, AgentCircuitData a, SimpleRegionInfo reg, IPEndPoint endPoint, bool newAgent); |
259 | 259 | ||
260 | private void InformClientOfNeighbourCompleted(IAsyncResult iar) | 260 | private void InformClientOfNeighbourCompleted(IAsyncResult iar) |
261 | { | 261 | { |
@@ -274,8 +274,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
274 | /// <param name="regionHandle"></param> | 274 | /// <param name="regionHandle"></param> |
275 | /// <param name="endPoint"></param> | 275 | /// <param name="endPoint"></param> |
276 | private void InformClientOfNeighbourAsync(ScenePresence avatar, AgentCircuitData a, SimpleRegionInfo reg, | 276 | private void InformClientOfNeighbourAsync(ScenePresence avatar, AgentCircuitData a, SimpleRegionInfo reg, |
277 | IPEndPoint endPoint) | 277 | IPEndPoint endPoint, bool newAgent) |
278 | { | 278 | { |
279 | // Let's wait just a little to give time to originating regions to catch up with closing child agents | ||
280 | // after a cross here | ||
281 | Thread.Sleep(200); | ||
282 | |||
279 | uint x, y; | 283 | uint x, y; |
280 | Utils.LongToUInts(reg.RegionHandle, out x, out y); | 284 | Utils.LongToUInts(reg.RegionHandle, out x, out y); |
281 | x = x / Constants.RegionSize; | 285 | x = x / Constants.RegionSize; |
@@ -287,7 +291,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
287 | 291 | ||
288 | bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a); | 292 | bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a); |
289 | 293 | ||
290 | if (regionAccepted) | 294 | if (regionAccepted && newAgent) |
291 | { | 295 | { |
292 | IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>(); | 296 | IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>(); |
293 | if (eq != null) | 297 | if (eq != null) |
@@ -362,6 +366,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
362 | 366 | ||
363 | /// Collect as many seeds as possible | 367 | /// Collect as many seeds as possible |
364 | Dictionary<ulong, string> seeds = new Dictionary<ulong, string>(avatar.Scene.GetChildrenSeeds(avatar.UUID)); | 368 | Dictionary<ulong, string> seeds = new Dictionary<ulong, string>(avatar.Scene.GetChildrenSeeds(avatar.UUID)); |
369 | //Console.WriteLine(" !!! No. of seeds: " + seeds.Count); | ||
365 | if (!seeds.ContainsKey(avatar.Scene.RegionInfo.RegionHandle)) | 370 | if (!seeds.ContainsKey(avatar.Scene.RegionInfo.RegionHandle)) |
366 | seeds.Add(avatar.Scene.RegionInfo.RegionHandle, avatar.ControllingClient.RequestClientInfo().CapsPath); | 371 | seeds.Add(avatar.Scene.RegionInfo.RegionHandle, avatar.ControllingClient.RequestClientInfo().CapsPath); |
367 | 372 | ||
@@ -369,22 +374,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
369 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); | 374 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); |
370 | foreach (SimpleRegionInfo neighbour in neighbours) | 375 | foreach (SimpleRegionInfo neighbour in neighbours) |
371 | { | 376 | { |
372 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); | 377 | if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle) |
373 | agent.BaseFolder = UUID.Zero; | ||
374 | agent.InventoryFolder = UUID.Zero; | ||
375 | agent.startpos = new Vector3(128, 128, 70); | ||
376 | agent.child = true; | ||
377 | |||
378 | if (newRegions.Contains(neighbour.RegionHandle)) | ||
379 | { | 378 | { |
380 | agent.CapsPath = Util.GetRandomCapsPath(); | ||
381 | avatar.AddNeighbourRegion(neighbour.RegionHandle, agent.CapsPath); | ||
382 | seeds.Add(neighbour.RegionHandle, agent.CapsPath); | ||
383 | } | ||
384 | else | ||
385 | agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, neighbour.RegionHandle); | ||
386 | 379 | ||
387 | cagents.Add(agent); | 380 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); |
381 | agent.BaseFolder = UUID.Zero; | ||
382 | agent.InventoryFolder = UUID.Zero; | ||
383 | agent.startpos = new Vector3(128, 128, 70); | ||
384 | agent.child = true; | ||
385 | |||
386 | if (newRegions.Contains(neighbour.RegionHandle)) | ||
387 | { | ||
388 | agent.CapsPath = Util.GetRandomCapsPath(); | ||
389 | avatar.AddNeighbourRegion(neighbour.RegionHandle, agent.CapsPath); | ||
390 | seeds.Add(neighbour.RegionHandle, agent.CapsPath); | ||
391 | } | ||
392 | else | ||
393 | agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, neighbour.RegionHandle); | ||
394 | |||
395 | cagents.Add(agent); | ||
396 | } | ||
388 | } | 397 | } |
389 | 398 | ||
390 | /// Update all child agent with everyone's seeds | 399 | /// Update all child agent with everyone's seeds |
@@ -398,16 +407,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
398 | //avatar.Scene.DumpChildrenSeeds(avatar.UUID); | 407 | //avatar.Scene.DumpChildrenSeeds(avatar.UUID); |
399 | //avatar.DumpKnownRegions(); | 408 | //avatar.DumpKnownRegions(); |
400 | 409 | ||
410 | bool newAgent = false; | ||
401 | int count = 0; | 411 | int count = 0; |
402 | foreach (SimpleRegionInfo neighbour in neighbours) | 412 | foreach (SimpleRegionInfo neighbour in neighbours) |
403 | { | 413 | { |
404 | // Don't do it if there's already an agent in that region | 414 | // Don't do it if there's already an agent in that region |
405 | if (newRegions.Contains(neighbour.RegionHandle)) | 415 | if (newRegions.Contains(neighbour.RegionHandle)) |
416 | newAgent = true; | ||
417 | else | ||
418 | newAgent = false; | ||
419 | |||
420 | if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle) | ||
406 | { | 421 | { |
407 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 422 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
408 | try | 423 | try |
409 | { | 424 | { |
410 | d.BeginInvoke(avatar, cagents[count], neighbour, neighbour.ExternalEndPoint, | 425 | d.BeginInvoke(avatar, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, |
411 | InformClientOfNeighbourCompleted, | 426 | InformClientOfNeighbourCompleted, |
412 | d); | 427 | d); |
413 | } | 428 | } |
@@ -429,11 +444,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
429 | 444 | ||
430 | } | 445 | } |
431 | } | 446 | } |
432 | else | ||
433 | m_log.Debug("[SCM]: Skipping common neighbor " + neighbour.RegionLocX + ", " + neighbour.RegionLocY); | ||
434 | |||
435 | count++; | 447 | count++; |
436 | |||
437 | } | 448 | } |
438 | } | 449 | } |
439 | 450 | ||
@@ -450,7 +461,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
450 | agent.child = true; | 461 | agent.child = true; |
451 | 462 | ||
452 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 463 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
453 | d.BeginInvoke(avatar, agent, region, region.ExternalEndPoint, | 464 | d.BeginInvoke(avatar, agent, region, region.ExternalEndPoint, true, |
454 | InformClientOfNeighbourCompleted, | 465 | InformClientOfNeighbourCompleted, |
455 | d); | 466 | d); |
456 | } | 467 | } |
@@ -748,6 +759,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
748 | // once we reach here... | 759 | // once we reach here... |
749 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | 760 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); |
750 | 761 | ||
762 | // Let's close some agents | ||
763 | avatar.CloseChildAgents(newRegionX, newRegionY); | ||
764 | |||
765 | string capsPath = String.Empty; | ||
751 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); | 766 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); |
752 | agent.BaseFolder = UUID.Zero; | 767 | agent.BaseFolder = UUID.Zero; |
753 | agent.InventoryFolder = UUID.Zero; | 768 | agent.InventoryFolder = UUID.Zero; |
@@ -757,36 +772,37 @@ namespace OpenSim.Region.Environment.Scenes | |||
757 | { | 772 | { |
758 | // brand new agent | 773 | // brand new agent |
759 | agent.CapsPath = Util.GetRandomCapsPath(); | 774 | agent.CapsPath = Util.GetRandomCapsPath(); |
775 | if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent)) | ||
776 | { | ||
777 | avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports."); | ||
778 | return; | ||
779 | } | ||
780 | |||
781 | // TODO Should construct this behind a method | ||
782 | capsPath = | ||
783 | "http://" + reg.ExternalHostName + ":" + reg.HttpPort | ||
784 | + "/CAPS/" + agent.CapsPath + "0000/"; | ||
785 | |||
786 | if (eq != null) | ||
787 | { | ||
788 | OSD Item = EventQueueHelper.EnableSimulator(reg.RegionHandle, reg.ExternalEndPoint); | ||
789 | eq.Enqueue(Item, avatar.UUID); | ||
790 | |||
791 | Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, reg.ExternalEndPoint.ToString(), capsPath); | ||
792 | eq.Enqueue(Item, avatar.UUID); | ||
793 | } | ||
794 | else | ||
795 | { | ||
796 | avatar.ControllingClient.InformClientOfNeighbour(reg.RegionHandle, reg.ExternalEndPoint); | ||
797 | } | ||
760 | } | 798 | } |
761 | else | 799 | else |
762 | { | 800 | { |
763 | // child agent already there | ||
764 | agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle); | 801 | agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle); |
802 | capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort | ||
803 | + "/CAPS/" + agent.CapsPath + "0000/"; | ||
765 | } | 804 | } |
766 | 805 | ||
767 | if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent)) | ||
768 | { | ||
769 | avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports."); | ||
770 | return; | ||
771 | } | ||
772 | |||
773 | // TODO Should construct this behind a method | ||
774 | string capsPath = | ||
775 | "http://" + reg.ExternalHostName + ":" + reg.HttpPort | ||
776 | + "/CAPS/" + agent.CapsPath + "0000/"; | ||
777 | |||
778 | if (eq != null) | ||
779 | { | ||
780 | OSD Item = EventQueueHelper.EnableSimulator(reg.RegionHandle, reg.ExternalEndPoint); | ||
781 | eq.Enqueue(Item, avatar.UUID); | ||
782 | |||
783 | Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, reg.ExternalEndPoint.ToString(), capsPath); | ||
784 | eq.Enqueue(Item, avatar.UUID); | ||
785 | } | ||
786 | else | ||
787 | { | ||
788 | avatar.ControllingClient.InformClientOfNeighbour(reg.RegionHandle, reg.ExternalEndPoint); | ||
789 | } | ||
790 | 806 | ||
791 | if (!m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, | 807 | if (!m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, |
792 | position, false)) | 808 | position, false)) |
@@ -826,24 +842,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
826 | } | 842 | } |
827 | 843 | ||
828 | 844 | ||
829 | // Let's close some children agents | ||
830 | avatar.CloseChildAgents(newRegionX, newRegionY); | ||
831 | // Close this ScenePresence too | ||
832 | //avatar.Close(); | ||
833 | |||
834 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 845 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
835 | 846 | ||
836 | //if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 847 | if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) |
837 | //{ | 848 | { |
838 | // CloseConnection(avatar.UUID); | 849 | CloseConnection(avatar.UUID); |
839 | //} | 850 | } |
840 | 851 | ||
841 | // if (teleport success) // seems to be always success here | 852 | // if (teleport success) // seems to be always success here |
842 | // the user may change their profile information in other region, | 853 | // the user may change their profile information in other region, |
843 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 854 | // so the userinfo in UserProfileCache is not reliable any more, delete it |
844 | if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) | 855 | if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) |
856 | { | ||
845 | m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); | 857 | m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); |
846 | m_log.InfoFormat("User {0} is going to another region, profile cache removed", avatar.UUID); | 858 | m_log.InfoFormat("User {0} is going to another region, profile cache removed", avatar.UUID); |
859 | } | ||
860 | |||
861 | // Close this ScenePresence too | ||
862 | //avatar.Close(); | ||
863 | |||
847 | } | 864 | } |
848 | else | 865 | else |
849 | { | 866 | { |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index f139ba5..4668dae 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -505,6 +505,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
505 | } | 505 | } |
506 | } | 506 | } |
507 | 507 | ||
508 | public void AdjustKnownSeeds() | ||
509 | { | ||
510 | Dictionary<ulong, string> seeds = Scene.GetChildrenSeeds(UUID); | ||
511 | List<ulong> old = new List<ulong>(); | ||
512 | foreach (ulong handle in seeds.Keys) | ||
513 | { | ||
514 | uint x, y; | ||
515 | Utils.LongToUInts(handle, out x, out y); | ||
516 | x = x / Constants.RegionSize; | ||
517 | y = y / Constants.RegionSize; | ||
518 | if (Util.IsOutsideView(x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) | ||
519 | { | ||
520 | old.Add(handle); | ||
521 | } | ||
522 | } | ||
523 | DropOldNeighbours(old); | ||
524 | Scene.SetChildrenSeed(UUID, seeds); | ||
525 | KnownRegions = seeds; | ||
526 | //Console.WriteLine(" ++++++++++AFTER+++++++++++++ "); | ||
527 | //DumpKnownRegions(); | ||
528 | } | ||
529 | |||
508 | public void DumpKnownRegions() | 530 | public void DumpKnownRegions() |
509 | { | 531 | { |
510 | Console.WriteLine("================ KnownRegions {0} ================", Scene.RegionInfo.RegionName); | 532 | Console.WriteLine("================ KnownRegions {0} ================", Scene.RegionInfo.RegionName); |
@@ -545,6 +567,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
545 | m_grouptitle = gm.GetGroupTitle(m_uuid); | 567 | m_grouptitle = gm.GetGroupTitle(m_uuid); |
546 | 568 | ||
547 | AbsolutePosition = m_controllingClient.StartPos; | 569 | AbsolutePosition = m_controllingClient.StartPos; |
570 | AdjustKnownSeeds(); | ||
548 | 571 | ||
549 | TrySetMovementAnimation("STAND"); // TODO: I think, this won't send anything, as we are still a child here... | 572 | TrySetMovementAnimation("STAND"); // TODO: I think, this won't send anything, as we are still a child here... |
550 | 573 | ||
@@ -935,7 +958,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
935 | if (m_knownChildRegions.ContainsKey(regionHandle)) | 958 | if (m_knownChildRegions.ContainsKey(regionHandle)) |
936 | { | 959 | { |
937 | m_knownChildRegions.Remove(regionHandle); | 960 | m_knownChildRegions.Remove(regionHandle); |
938 | //Console.WriteLine(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count); | 961 | //Console.WriteLine(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count); |
939 | } | 962 | } |
940 | } | 963 | } |
941 | } | 964 | } |
@@ -1949,9 +1972,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1949 | CheckForBorderCrossing(); | 1972 | CheckForBorderCrossing(); |
1950 | CheckForSignificantMovement(); // sends update to the modules. | 1973 | CheckForSignificantMovement(); // sends update to the modules. |
1951 | } | 1974 | } |
1952 | |||
1953 | //if ((x++ % 30) == 0) | ||
1954 | // Console.WriteLine(" >> In {0} known regions: {0}, seeds:{1}", Scene.RegionInfo.RegionName, KnownRegions.Count, Scene.GetChildrenSeeds(UUID)); | ||
1955 | } | 1975 | } |
1956 | 1976 | ||
1957 | #endregion | 1977 | #endregion |
@@ -2412,6 +2432,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
2412 | m_physicsActor.Flying); | 2432 | m_physicsActor.Flying); |
2413 | if (crossingSuccessful) | 2433 | if (crossingSuccessful) |
2414 | { | 2434 | { |
2435 | // Next, let's close the child agent connections that are too far away. | ||
2436 | CloseChildAgents(neighbourx, neighboury); | ||
2437 | |||
2415 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | 2438 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); |
2416 | 2439 | ||
2417 | //Console.WriteLine("BEFORE CROSS"); | 2440 | //Console.WriteLine("BEFORE CROSS"); |
@@ -2446,15 +2469,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
2446 | CrossAttachmentsIntoNewRegion(neighbourHandle, true); | 2469 | CrossAttachmentsIntoNewRegion(neighbourHandle, true); |
2447 | 2470 | ||
2448 | // m_scene.SendKillObject(m_localId); | 2471 | // m_scene.SendKillObject(m_localId); |
2449 | // Next, let's close the child agent connections that are too far away. | ||
2450 | CloseChildAgents(neighbourx, neighboury); | ||
2451 | 2472 | ||
2452 | m_scene.NotifyMyCoarseLocationChange(); | 2473 | m_scene.NotifyMyCoarseLocationChange(); |
2453 | // the user may change their profile information in other region, | 2474 | // the user may change their profile information in other region, |
2454 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 2475 | // so the userinfo in UserProfileCache is not reliable any more, delete it |
2455 | if (m_scene.NeedSceneCacheClear(UUID)) | 2476 | if (m_scene.NeedSceneCacheClear(UUID)) |
2477 | { | ||
2456 | m_scene.CommsManager.UserProfileCacheService.RemoveUser(UUID); | 2478 | m_scene.CommsManager.UserProfileCacheService.RemoveUser(UUID); |
2457 | m_log.InfoFormat("[AVATAR]: User {0} is going to another region, profile cache removed", UUID); | 2479 | m_log.InfoFormat("[AVATAR]: User {0} is going to another region, profile cache removed", UUID); |
2480 | } | ||
2458 | } | 2481 | } |
2459 | else | 2482 | else |
2460 | { | 2483 | { |
@@ -2487,16 +2510,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
2487 | { | 2510 | { |
2488 | foreach (ulong handle in m_knownChildRegions.Keys) | 2511 | foreach (ulong handle in m_knownChildRegions.Keys) |
2489 | { | 2512 | { |
2490 | uint x, y; | 2513 | // Don't close the agent on this region yet |
2491 | Utils.LongToUInts(handle, out x, out y); | 2514 | if (handle != Scene.RegionInfo.RegionHandle) |
2492 | x = x / Constants.RegionSize; | ||
2493 | y = y / Constants.RegionSize; | ||
2494 | |||
2495 | //Console.WriteLine("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | ||
2496 | //Console.WriteLine("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | ||
2497 | if (Util.IsOutsideView(x, newRegionX, y, newRegionY)) | ||
2498 | { | 2515 | { |
2499 | byebyeRegions.Add(handle); | 2516 | uint x, y; |
2517 | Utils.LongToUInts(handle, out x, out y); | ||
2518 | x = x / Constants.RegionSize; | ||
2519 | y = y / Constants.RegionSize; | ||
2520 | |||
2521 | //Console.WriteLine("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | ||
2522 | //Console.WriteLine("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | ||
2523 | if (Util.IsOutsideView(x, newRegionX, y, newRegionY)) | ||
2524 | { | ||
2525 | byebyeRegions.Add(handle); | ||
2526 | } | ||
2500 | } | 2527 | } |
2501 | } | 2528 | } |
2502 | } | 2529 | } |
@@ -2510,7 +2537,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2510 | RemoveNeighbourRegion(handle); | 2537 | RemoveNeighbourRegion(handle); |
2511 | } | 2538 | } |
2512 | 2539 | ||
2513 | |||
2514 | } | 2540 | } |
2515 | 2541 | ||
2516 | #endregion | 2542 | #endregion |