diff options
author | Charles Krinke | 2008-12-14 02:17:12 +0000 |
---|---|---|
committer | Charles Krinke | 2008-12-14 02:17:12 +0000 |
commit | e6eb571c1d19972fe7eb4c3f7de113b1b91f5e02 (patch) | |
tree | 2140979c8cf3f4d4d2b60a355be65abd659508b9 /OpenSim/Region/Environment/Scenes/ScenePresence.cs | |
parent | Mantis#2811. Thank you kindly, Diva for a patch that resolves (diff) | |
download | opensim-SC_OLD-e6eb571c1d19972fe7eb4c3f7de113b1b91f5e02.zip opensim-SC_OLD-e6eb571c1d19972fe7eb4c3f7de113b1b91f5e02.tar.gz opensim-SC_OLD-e6eb571c1d19972fe7eb4c3f7de113b1b91f5e02.tar.bz2 opensim-SC_OLD-e6eb571c1d19972fe7eb4c3f7de113b1b91f5e02.tar.xz |
Mantis#2725. Thank you kindly, Diva, for a patch that:
Adds missing protocol pieces for EstablishAgentCommunication
event which allows the client to activate CAPS and the EQ for
child agents.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 129 |
1 files changed, 101 insertions, 28 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 3bd6be9..f139ba5 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -188,8 +188,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
188 | 188 | ||
189 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); | 189 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); |
190 | 190 | ||
191 | //neighbouring regions we have enabled a child agent in | 191 | // neighbouring regions we have enabled a child agent in |
192 | private readonly List<ulong> m_knownChildRegions = new List<ulong>(); | 192 | // holds the seed cap for the child agent in that region |
193 | private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); | ||
193 | 194 | ||
194 | /// <summary> | 195 | /// <summary> |
195 | /// Implemented Control Flags | 196 | /// Implemented Control Flags |
@@ -483,9 +484,38 @@ namespace OpenSim.Region.Environment.Scenes | |||
483 | /// <summary> | 484 | /// <summary> |
484 | /// These are the region handles known by the avatar. | 485 | /// These are the region handles known by the avatar. |
485 | /// </summary> | 486 | /// </summary> |
486 | public List<ulong> KnownChildRegions | 487 | public List<ulong> KnownChildRegionHandles |
488 | { | ||
489 | get | ||
490 | { | ||
491 | if (m_knownChildRegions.Count == 0) | ||
492 | return new List<ulong>(); | ||
493 | else | ||
494 | return new List<ulong>(m_knownChildRegions.Keys); | ||
495 | } | ||
496 | } | ||
497 | |||
498 | public Dictionary<ulong, string> KnownRegions | ||
487 | { | 499 | { |
488 | get { return m_knownChildRegions; } | 500 | get { return m_knownChildRegions; } |
501 | set | ||
502 | { | ||
503 | //Console.WriteLine(" !! Setting known regions in {0} to {1}", Scene.RegionInfo.RegionName, value.Count); | ||
504 | m_knownChildRegions = value; | ||
505 | } | ||
506 | } | ||
507 | |||
508 | public void DumpKnownRegions() | ||
509 | { | ||
510 | Console.WriteLine("================ KnownRegions {0} ================", Scene.RegionInfo.RegionName); | ||
511 | foreach (KeyValuePair<ulong, string> kvp in KnownRegions) | ||
512 | { | ||
513 | uint x, y; | ||
514 | Utils.LongToUInts(kvp.Key, out x, out y); | ||
515 | x = x / Constants.RegionSize; | ||
516 | y = y / Constants.RegionSize; | ||
517 | Console.WriteLine(" >> {0}, {1}: {2}", x, y, kvp.Value); | ||
518 | } | ||
489 | } | 519 | } |
490 | 520 | ||
491 | public AnimationSet Animations | 521 | public AnimationSet Animations |
@@ -529,6 +559,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
529 | CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); | 559 | CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); |
530 | if (userInfo != null) | 560 | if (userInfo != null) |
531 | userInfo.OnItemReceived += ItemReceived; | 561 | userInfo.OnItemReceived += ItemReceived; |
562 | |||
563 | m_log.Info("[AVATAR]: New ScenePresence in " + Scene.RegionInfo.RegionName); | ||
532 | } | 564 | } |
533 | 565 | ||
534 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, | 566 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, |
@@ -742,7 +774,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
742 | m_log.DebugFormat( | 774 | m_log.DebugFormat( |
743 | "[SCENE]: Upgrading child to root agent for {0} in {1}", | 775 | "[SCENE]: Upgrading child to root agent for {0} in {1}", |
744 | Name, m_scene.RegionInfo.RegionName); | 776 | Name, m_scene.RegionInfo.RegionName); |
745 | 777 | ||
778 | m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); | ||
779 | |||
746 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 780 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
747 | if (gm != null) | 781 | if (gm != null) |
748 | m_grouptitle = gm.GetGroupTitle(m_uuid); | 782 | m_grouptitle = gm.GetGroupTitle(m_uuid); |
@@ -881,25 +915,43 @@ namespace OpenSim.Region.Environment.Scenes | |||
881 | SendFullUpdateToAllClients(); | 915 | SendFullUpdateToAllClients(); |
882 | } | 916 | } |
883 | 917 | ||
884 | public void AddNeighbourRegion(ulong regionHandle) | 918 | public void AddNeighbourRegion(ulong regionHandle, string cap) |
885 | { | 919 | { |
886 | if (!m_knownChildRegions.Contains(regionHandle)) | 920 | lock (m_knownChildRegions) |
887 | { | 921 | { |
888 | m_knownChildRegions.Add(regionHandle); | 922 | if (!m_knownChildRegions.ContainsKey(regionHandle)) |
923 | { | ||
924 | uint x, y; | ||
925 | Utils.LongToUInts(regionHandle, out x, out y); | ||
926 | m_knownChildRegions.Add(regionHandle, cap); | ||
927 | } | ||
889 | } | 928 | } |
890 | } | 929 | } |
891 | 930 | ||
892 | public void RemoveNeighbourRegion(ulong regionHandle) | 931 | public void RemoveNeighbourRegion(ulong regionHandle) |
893 | { | 932 | { |
894 | if (m_knownChildRegions.Contains(regionHandle)) | 933 | lock (m_knownChildRegions) |
895 | { | 934 | { |
896 | m_knownChildRegions.Remove(regionHandle); | 935 | if (m_knownChildRegions.ContainsKey(regionHandle)) |
936 | { | ||
937 | m_knownChildRegions.Remove(regionHandle); | ||
938 | //Console.WriteLine(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count); | ||
939 | } | ||
940 | } | ||
941 | } | ||
942 | |||
943 | public void DropOldNeighbours(List<ulong> oldRegions) | ||
944 | { | ||
945 | foreach (ulong handle in oldRegions) | ||
946 | { | ||
947 | RemoveNeighbourRegion(handle); | ||
948 | Scene.DropChildSeed(UUID, handle); | ||
897 | } | 949 | } |
898 | } | 950 | } |
899 | 951 | ||
900 | public List<ulong> GetKnownRegionList() | 952 | public List<ulong> GetKnownRegionList() |
901 | { | 953 | { |
902 | return m_knownChildRegions; | 954 | return new List<ulong>(m_knownChildRegions.Keys); |
903 | } | 955 | } |
904 | 956 | ||
905 | #endregion | 957 | #endregion |
@@ -1856,6 +1908,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1856 | 1908 | ||
1857 | #region Overridden Methods | 1909 | #region Overridden Methods |
1858 | 1910 | ||
1911 | int x = 0; | ||
1859 | public override void Update() | 1912 | public override void Update() |
1860 | { | 1913 | { |
1861 | SendPrimUpdates(); | 1914 | SendPrimUpdates(); |
@@ -1896,6 +1949,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1896 | CheckForBorderCrossing(); | 1949 | CheckForBorderCrossing(); |
1897 | CheckForSignificantMovement(); // sends update to the modules. | 1950 | CheckForSignificantMovement(); // sends update to the modules. |
1898 | } | 1951 | } |
1952 | |||
1953 | //if ((x++ % 30) == 0) | ||
1954 | // Console.WriteLine(" >> In {0} known regions: {0}, seeds:{1}", Scene.RegionInfo.RegionName, KnownRegions.Count, Scene.GetChildrenSeeds(UUID)); | ||
1899 | } | 1955 | } |
1900 | 1956 | ||
1901 | #endregion | 1957 | #endregion |
@@ -2338,7 +2394,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2338 | // When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar | 2394 | // When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar |
2339 | // This means we need to remove the current caps handler here and possibly compensate later, | 2395 | // This means we need to remove the current caps handler here and possibly compensate later, |
2340 | // in case both scenes are being hosted on the same region server. Messy | 2396 | // in case both scenes are being hosted on the same region server. Messy |
2341 | m_scene.RemoveCapsHandler(UUID); | 2397 | //m_scene.RemoveCapsHandler(UUID); |
2342 | newpos = newpos + (vel); | 2398 | newpos = newpos + (vel); |
2343 | 2399 | ||
2344 | CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(UUID); | 2400 | CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(UUID); |
@@ -2358,10 +2414,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
2358 | { | 2414 | { |
2359 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | 2415 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); |
2360 | 2416 | ||
2417 | //Console.WriteLine("BEFORE CROSS"); | ||
2418 | //Scene.DumpChildrenSeeds(UUID); | ||
2419 | //DumpKnownRegions(); | ||
2420 | |||
2361 | // TODO Should construct this behind a method | 2421 | // TODO Should construct this behind a method |
2362 | string capsPath = | 2422 | string capsPath = |
2363 | "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort | 2423 | "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort |
2364 | + "/CAPS/" + circuitdata.CapsPath + "0000/"; | 2424 | + "/CAPS/" + m_knownChildRegions[neighbourRegion.RegionHandle] /*circuitdata.CapsPath*/ + "0000/"; |
2365 | 2425 | ||
2366 | m_log.DebugFormat("[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, m_uuid); | 2426 | m_log.DebugFormat("[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, m_uuid); |
2367 | 2427 | ||
@@ -2386,6 +2446,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2386 | CrossAttachmentsIntoNewRegion(neighbourHandle, true); | 2446 | CrossAttachmentsIntoNewRegion(neighbourHandle, true); |
2387 | 2447 | ||
2388 | // m_scene.SendKillObject(m_localId); | 2448 | // m_scene.SendKillObject(m_localId); |
2449 | // Next, let's close the child agent connections that are too far away. | ||
2450 | CloseChildAgents(neighbourx, neighboury); | ||
2389 | 2451 | ||
2390 | m_scene.NotifyMyCoarseLocationChange(); | 2452 | m_scene.NotifyMyCoarseLocationChange(); |
2391 | // the user may change their profile information in other region, | 2453 | // the user may change their profile information in other region, |
@@ -2401,6 +2463,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
2401 | m_scene.AddCapsHandler(UUID); | 2463 | m_scene.AddCapsHandler(UUID); |
2402 | } | 2464 | } |
2403 | } | 2465 | } |
2466 | |||
2467 | //Console.WriteLine("AFTER CROSS"); | ||
2468 | //Scene.DumpChildrenSeeds(UUID); | ||
2469 | //DumpKnownRegions(); | ||
2470 | |||
2404 | } | 2471 | } |
2405 | 2472 | ||
2406 | /// <summary> | 2473 | /// <summary> |
@@ -2413,31 +2480,36 @@ namespace OpenSim.Region.Environment.Scenes | |||
2413 | public void CloseChildAgents(uint newRegionX, uint newRegionY) | 2480 | public void CloseChildAgents(uint newRegionX, uint newRegionY) |
2414 | { | 2481 | { |
2415 | List<ulong> byebyeRegions = new List<ulong>(); | 2482 | List<ulong> byebyeRegions = new List<ulong>(); |
2483 | m_log.DebugFormat("[AVATAR]: Closing child agents. Checking {0} regions in {1}", m_knownChildRegions.Keys.Count, Scene.RegionInfo.RegionName); | ||
2484 | //DumpKnownRegions(); | ||
2416 | 2485 | ||
2417 | foreach (ulong handle in m_knownChildRegions) | 2486 | lock (m_knownChildRegions) |
2418 | { | 2487 | { |
2419 | uint x, y; | 2488 | foreach (ulong handle in m_knownChildRegions.Keys) |
2420 | Utils.LongToUInts(handle, out x, out y); | ||
2421 | x = x / Constants.RegionSize; | ||
2422 | y = y / Constants.RegionSize; | ||
2423 | |||
2424 | if (Util.IsOutsideView(x, newRegionX, y, newRegionY)) | ||
2425 | { | 2489 | { |
2426 | Console.WriteLine("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs(x-newRegionX)); | 2490 | uint x, y; |
2427 | Console.WriteLine("---> y: " + y + "; newy:" + newRegionY); | 2491 | Utils.LongToUInts(handle, out x, out y); |
2428 | byebyeRegions.Add(handle); | 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 | { | ||
2499 | byebyeRegions.Add(handle); | ||
2500 | } | ||
2429 | } | 2501 | } |
2430 | } | 2502 | } |
2431 | foreach (ulong handle in byebyeRegions) | ||
2432 | { | ||
2433 | RemoveNeighbourRegion(handle); | ||
2434 | } | ||
2435 | |||
2436 | if (byebyeRegions.Count > 0) | 2503 | if (byebyeRegions.Count > 0) |
2437 | { | 2504 | { |
2438 | m_log.Info("[AVATAR]: Closing " + byebyeRegions.Count + " child agents"); | 2505 | m_log.Info("[AVATAR]: Closing " + byebyeRegions.Count + " child agents"); |
2439 | m_scene.SceneGridService.SendCloseChildAgentConnections(m_controllingClient.AgentId, byebyeRegions); | 2506 | m_scene.SceneGridService.SendCloseChildAgentConnections(m_controllingClient.AgentId, byebyeRegions); |
2440 | } | 2507 | } |
2508 | foreach (ulong handle in byebyeRegions) | ||
2509 | { | ||
2510 | RemoveNeighbourRegion(handle); | ||
2511 | } | ||
2512 | |||
2441 | 2513 | ||
2442 | } | 2514 | } |
2443 | 2515 | ||
@@ -2940,7 +3012,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2940 | 3012 | ||
2941 | m_DrawDistance = (float)info.GetValue("m_DrawDistance", typeof(float)); | 3013 | m_DrawDistance = (float)info.GetValue("m_DrawDistance", typeof(float)); |
2942 | m_appearance = (AvatarAppearance)info.GetValue("m_appearance", typeof(AvatarAppearance)); | 3014 | m_appearance = (AvatarAppearance)info.GetValue("m_appearance", typeof(AvatarAppearance)); |
2943 | m_knownChildRegions = (List<ulong>)info.GetValue("m_knownChildRegions", typeof(List<ulong>)); | 3015 | |
3016 | m_knownChildRegions = (Dictionary<ulong, string>)info.GetValue("m_knownChildRegions", typeof(Dictionary<ulong, string>)); | ||
2944 | 3017 | ||
2945 | posLastSignificantMove | 3018 | posLastSignificantMove |
2946 | = new Vector3( | 3019 | = new Vector3( |