diff options
author | Melanie | 2012-05-27 19:24:30 +0100 |
---|---|---|
committer | Melanie | 2012-05-27 19:24:30 +0100 |
commit | 884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f (patch) | |
tree | dd692a54213f86fd64bd29c6662584df85088193 /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' into careminster (diff) | |
parent | minor: code formatting from 0b72f773 (diff) | |
download | opensim-SC-884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f.zip opensim-SC-884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f.tar.gz opensim-SC-884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f.tar.bz2 opensim-SC-884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Data/MySQL/MySQLSimulationData.cs
OpenSim/Data/MySQL/Resources/RegionStore.migrations
OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
OpenSim/Region/Framework/Scenes/Scene.cs
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
Diffstat (limited to 'OpenSim/Region/CoreModules')
17 files changed, 1171 insertions, 605 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2bfe190..7a91481 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | private Scene m_scene; | 52 | private Scene m_scene; |
53 | private IDialogModule m_dialogModule; | 53 | private IInventoryAccessModule m_invAccessModule; |
54 | 54 | ||
55 | /// <summary> | 55 | /// <summary> |
56 | /// Are attachments enabled? | 56 | /// Are attachments enabled? |
@@ -72,7 +72,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
72 | public void AddRegion(Scene scene) | 72 | public void AddRegion(Scene scene) |
73 | { | 73 | { |
74 | m_scene = scene; | 74 | m_scene = scene; |
75 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | ||
76 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); | 75 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); |
77 | 76 | ||
78 | if (Enabled) | 77 | if (Enabled) |
@@ -89,7 +88,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
89 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | 88 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; |
90 | } | 89 | } |
91 | 90 | ||
92 | public void RegionLoaded(Scene scene) {} | 91 | public void RegionLoaded(Scene scene) |
92 | { | ||
93 | m_invAccessModule = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | ||
94 | } | ||
93 | 95 | ||
94 | public void Close() | 96 | public void Close() |
95 | { | 97 | { |
@@ -629,6 +631,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
629 | /// <returns>The user inventory item created that holds the attachment.</returns> | 631 | /// <returns>The user inventory item created that holds the attachment.</returns> |
630 | private InventoryItemBase AddSceneObjectAsNewAttachmentInInv(IScenePresence sp, SceneObjectGroup grp) | 632 | private InventoryItemBase AddSceneObjectAsNewAttachmentInInv(IScenePresence sp, SceneObjectGroup grp) |
631 | { | 633 | { |
634 | if (m_invAccessModule == null) | ||
635 | return null; | ||
636 | |||
632 | // m_log.DebugFormat( | 637 | // m_log.DebugFormat( |
633 | // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", | 638 | // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", |
634 | // grp.Name, grp.LocalId, remoteClient.Name); | 639 | // grp.Name, grp.LocalId, remoteClient.Name); |
@@ -702,16 +707,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
702 | // sets itemID so client can show item as 'attached' in inventory | 707 | // sets itemID so client can show item as 'attached' in inventory |
703 | grp.FromItemID = item.ID; | 708 | grp.FromItemID = item.ID; |
704 | 709 | ||
705 | if (m_scene.AddInventoryItem(item)) | ||
706 | { | ||
707 | sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | ||
708 | } | ||
709 | else | ||
710 | { | ||
711 | if (m_dialogModule != null) | ||
712 | m_dialogModule.SendAlertToUser(sp.ControllingClient, "Operation failed"); | ||
713 | } | ||
714 | |||
715 | return item; | 710 | return item; |
716 | } | 711 | } |
717 | 712 | ||
@@ -760,76 +755,75 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
760 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 755 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
761 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc) | 756 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc) |
762 | { | 757 | { |
763 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 758 | if (m_invAccessModule == null) |
764 | if (invAccess != null) | 759 | return null; |
760 | |||
761 | lock (sp.AttachmentsSyncLock) | ||
765 | { | 762 | { |
766 | lock (sp.AttachmentsSyncLock) | 763 | SceneObjectGroup objatt; |
764 | |||
765 | if (itemID != UUID.Zero) | ||
766 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, | ||
767 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
768 | false, false, sp.UUID, true); | ||
769 | else | ||
770 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, | ||
771 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
772 | false, false, sp.UUID, true); | ||
773 | |||
774 | // m_log.DebugFormat( | ||
775 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | ||
776 | // objatt.Name, remoteClient.Name, AttachmentPt); | ||
777 | |||
778 | if (objatt != null) | ||
767 | { | 779 | { |
768 | SceneObjectGroup objatt; | 780 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. |
769 | 781 | objatt.HasGroupChanged = false; | |
770 | if (itemID != UUID.Zero) | 782 | bool tainted = false; |
771 | objatt = invAccess.RezObject(sp.ControllingClient, | 783 | if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) |
772 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | 784 | tainted = true; |
773 | false, false, sp.UUID, true); | ||
774 | else | ||
775 | objatt = invAccess.RezObject(sp.ControllingClient, | ||
776 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
777 | false, false, sp.UUID, true); | ||
778 | |||
779 | // m_log.DebugFormat( | ||
780 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | ||
781 | // objatt.Name, remoteClient.Name, AttachmentPt); | ||
782 | |||
783 | if (objatt != null) | ||
784 | { | ||
785 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. | ||
786 | objatt.HasGroupChanged = false; | ||
787 | bool tainted = false; | ||
788 | if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) | ||
789 | tainted = true; | ||
790 | |||
791 | // This will throw if the attachment fails | ||
792 | try | ||
793 | { | ||
794 | AttachObject(sp, objatt, attachmentPt, false); | ||
795 | } | ||
796 | catch (Exception e) | ||
797 | { | ||
798 | m_log.ErrorFormat( | ||
799 | "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", | ||
800 | objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); | ||
801 | |||
802 | // Make sure the object doesn't stick around and bail | ||
803 | sp.RemoveAttachment(objatt); | ||
804 | m_scene.DeleteSceneObject(objatt, false); | ||
805 | return null; | ||
806 | } | ||
807 | |||
808 | if (tainted) | ||
809 | objatt.HasGroupChanged = true; | ||
810 | |||
811 | if (doc != null) | ||
812 | { | ||
813 | objatt.LoadScriptState(doc); | ||
814 | objatt.ResetOwnerChangeFlag(); | ||
815 | } | ||
816 | |||
817 | // Fire after attach, so we don't get messy perms dialogs | ||
818 | // 4 == AttachedRez | ||
819 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | ||
820 | objatt.ResumeScripts(); | ||
821 | |||
822 | // Do this last so that event listeners have access to all the effects of the attachment | ||
823 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); | ||
824 | 785 | ||
825 | return objatt; | 786 | // This will throw if the attachment fails |
787 | try | ||
788 | { | ||
789 | AttachObject(sp, objatt, attachmentPt, false); | ||
826 | } | 790 | } |
827 | else | 791 | catch (Exception e) |
828 | { | 792 | { |
829 | m_log.WarnFormat( | 793 | m_log.ErrorFormat( |
830 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | 794 | "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", |
831 | itemID, sp.Name, attachmentPt); | 795 | objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); |
796 | |||
797 | // Make sure the object doesn't stick around and bail | ||
798 | sp.RemoveAttachment(objatt); | ||
799 | m_scene.DeleteSceneObject(objatt, false); | ||
800 | return null; | ||
832 | } | 801 | } |
802 | |||
803 | if (doc != null) | ||
804 | { | ||
805 | objatt.LoadScriptState(doc); | ||
806 | objatt.ResetOwnerChangeFlag(); | ||
807 | } | ||
808 | |||
809 | if (tainted) | ||
810 | objatt.HasGroupChanged = true; | ||
811 | |||
812 | // Fire after attach, so we don't get messy perms dialogs | ||
813 | // 4 == AttachedRez | ||
814 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | ||
815 | objatt.ResumeScripts(); | ||
816 | |||
817 | // Do this last so that event listeners have access to all the effects of the attachment | ||
818 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); | ||
819 | |||
820 | return objatt; | ||
821 | } | ||
822 | else | ||
823 | { | ||
824 | m_log.WarnFormat( | ||
825 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | ||
826 | itemID, sp.Name, attachmentPt); | ||
833 | } | 827 | } |
834 | } | 828 | } |
835 | 829 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 42d07fd..5e89eec 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -99,12 +99,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
99 | public void TestAddAttachmentFromGround() | 99 | public void TestAddAttachmentFromGround() |
100 | { | 100 | { |
101 | TestHelpers.InMethod(); | 101 | TestHelpers.InMethod(); |
102 | // log4net.Config.XmlConfigurator.Configure(); | 102 | // TestHelpers.EnableLogging(); |
103 | 103 | ||
104 | AddPresence(); | 104 | AddPresence(); |
105 | string attName = "att"; | 105 | string attName = "att"; |
106 | 106 | ||
107 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup; | 107 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup; |
108 | 108 | ||
109 | m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false); | 109 | m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false); |
110 | 110 | ||
@@ -123,6 +123,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
123 | Assert.That( | 123 | Assert.That( |
124 | m_presence.Appearance.GetAttachpoint(attSo.FromItemID), | 124 | m_presence.Appearance.GetAttachpoint(attSo.FromItemID), |
125 | Is.EqualTo((int)AttachmentPoint.Chest)); | 125 | Is.EqualTo((int)AttachmentPoint.Chest)); |
126 | |||
127 | InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); | ||
128 | Assert.That(attachmentItem, Is.Not.Null); | ||
129 | Assert.That(attachmentItem.Name, Is.EqualTo(attName)); | ||
130 | |||
131 | InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(m_presence.UUID, AssetType.Object); | ||
132 | Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); | ||
133 | |||
134 | // TestHelpers.DisableLogging(); | ||
126 | } | 135 | } |
127 | 136 | ||
128 | [Test] | 137 | [Test] |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 3728b85..06f27e2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -415,12 +415,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
415 | 415 | ||
416 | protected override void StoreBackwards(UUID friendID, UUID agentID) | 416 | protected override void StoreBackwards(UUID friendID, UUID agentID) |
417 | { | 417 | { |
418 | Boolean agentIsLocal = true; | 418 | bool agentIsLocal = true; |
419 | Boolean friendIsLocal = true; | 419 | // bool friendIsLocal = true; |
420 | |||
420 | if (UserManagementModule != null) | 421 | if (UserManagementModule != null) |
421 | { | 422 | { |
422 | agentIsLocal = UserManagementModule.IsLocalGridUser(agentID); | 423 | agentIsLocal = UserManagementModule.IsLocalGridUser(agentID); |
423 | friendIsLocal = UserManagementModule.IsLocalGridUser(friendID); | 424 | // friendIsLocal = UserManagementModule.IsLocalGridUser(friendID); |
424 | } | 425 | } |
425 | 426 | ||
426 | // Is the requester a local user? | 427 | // Is the requester a local user? |
@@ -507,7 +508,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
507 | { | 508 | { |
508 | friendUUI = finfo.Friend; | 509 | friendUUI = finfo.Friend; |
509 | theFriendUUID = friendUUI; | 510 | theFriendUUID = friendUUI; |
510 | UUID utmp = UUID.Zero; String url = String.Empty; String first = String.Empty, last = String.Empty, tmp = String.Empty; | 511 | UUID utmp = UUID.Zero; |
512 | string url = String.Empty; | ||
513 | string first = String.Empty; | ||
514 | string last = String.Empty; | ||
515 | |||
511 | // If it's confirming the friendship, we already have the full UUI with the secret | 516 | // If it's confirming the friendship, we already have the full UUI with the secret |
512 | if (Util.ParseUniversalUserIdentifier(theFriendUUID, out utmp, out url, out first, out last, out secret)) | 517 | if (Util.ParseUniversalUserIdentifier(theFriendUUID, out utmp, out url, out first, out last, out secret)) |
513 | { | 518 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index f9e2b2f..5d9d67f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -46,7 +46,30 @@ using Nini.Config; | |||
46 | 46 | ||
47 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | 47 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer |
48 | { | 48 | { |
49 | public class EntityTransferModule : ISharedRegionModule, IEntityTransferModule | 49 | /// <summary> |
50 | /// The possible states that an agent can be in when its being transferred between regions. | ||
51 | /// </summary> | ||
52 | /// <remarks> | ||
53 | /// This is a state machine. | ||
54 | /// | ||
55 | /// [Entry] => Preparing | ||
56 | /// Preparing => { Transferring || CleaningUp || [Exit] } | ||
57 | /// Transferring => { ReceivedAtDestination || CleaningUp } | ||
58 | /// ReceivedAtDestination => CleaningUp | ||
59 | /// CleaningUp => [Exit] | ||
60 | /// | ||
61 | /// In other words, agents normally travel throwing Preparing => Transferring => ReceivedAtDestination => CleaningUp | ||
62 | /// However, any state can transition to CleaningUp if the teleport has failed. | ||
63 | /// </remarks> | ||
64 | enum AgentTransferState | ||
65 | { | ||
66 | Preparing, // The agent is being prepared for transfer | ||
67 | Transferring, // The agent is in the process of being transferred to a destination | ||
68 | ReceivedAtDestination, // The destination has notified us that the agent has been successfully received | ||
69 | CleaningUp // The agent is being changed to child/removed after a transfer | ||
70 | } | ||
71 | |||
72 | public class EntityTransferModule : INonSharedRegionModule, IEntityTransferModule | ||
50 | { | 73 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 74 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 75 | ||
@@ -65,12 +88,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
65 | public bool EnableWaitForCallbackFromTeleportDest { get; set; } | 88 | public bool EnableWaitForCallbackFromTeleportDest { get; set; } |
66 | 89 | ||
67 | protected bool m_Enabled = false; | 90 | protected bool m_Enabled = false; |
68 | protected Scene m_aScene; | 91 | |
69 | protected List<Scene> m_Scenes = new List<Scene>(); | 92 | protected Scene m_scene; |
70 | protected List<UUID> m_agentsInTransit; | 93 | |
94 | private Dictionary<UUID, AgentTransferState> m_agentsInTransit; | ||
95 | |||
71 | private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions = | 96 | private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions = |
72 | new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>(); | 97 | new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>(); |
73 | 98 | ||
99 | private IEventQueue m_eqModule; | ||
100 | |||
74 | #region ISharedRegionModule | 101 | #region ISharedRegionModule |
75 | 102 | ||
76 | public Type ReplaceableInterface | 103 | public Type ReplaceableInterface |
@@ -116,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
116 | MaxTransferDistance = DefaultMaxTransferDistance; | 143 | MaxTransferDistance = DefaultMaxTransferDistance; |
117 | } | 144 | } |
118 | 145 | ||
119 | m_agentsInTransit = new List<UUID>(); | 146 | m_agentsInTransit = new Dictionary<UUID, AgentTransferState>(); |
120 | m_Enabled = true; | 147 | m_Enabled = true; |
121 | } | 148 | } |
122 | 149 | ||
@@ -129,10 +156,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
129 | if (!m_Enabled) | 156 | if (!m_Enabled) |
130 | return; | 157 | return; |
131 | 158 | ||
132 | if (m_aScene == null) | 159 | m_scene = scene; |
133 | m_aScene = scene; | ||
134 | 160 | ||
135 | m_Scenes.Add(scene); | ||
136 | scene.RegisterModuleInterface<IEntityTransferModule>(this); | 161 | scene.RegisterModuleInterface<IEntityTransferModule>(this); |
137 | scene.EventManager.OnNewClient += OnNewClient; | 162 | scene.EventManager.OnNewClient += OnNewClient; |
138 | } | 163 | } |
@@ -143,26 +168,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
143 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 168 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
144 | } | 169 | } |
145 | 170 | ||
146 | public virtual void Close() | 171 | public virtual void Close() {} |
147 | { | ||
148 | if (!m_Enabled) | ||
149 | return; | ||
150 | } | ||
151 | |||
152 | public virtual void RemoveRegion(Scene scene) | ||
153 | { | ||
154 | if (!m_Enabled) | ||
155 | return; | ||
156 | if (scene == m_aScene) | ||
157 | m_aScene = null; | ||
158 | 172 | ||
159 | m_Scenes.Remove(scene); | 173 | public virtual void RemoveRegion(Scene scene) {} |
160 | } | ||
161 | 174 | ||
162 | public virtual void RegionLoaded(Scene scene) | 175 | public virtual void RegionLoaded(Scene scene) |
163 | { | 176 | { |
164 | if (!m_Enabled) | 177 | if (!m_Enabled) |
165 | return; | 178 | return; |
179 | |||
180 | m_eqModule = m_scene.RequestModuleInterface<IEventQueue>(); | ||
166 | } | 181 | } |
167 | 182 | ||
168 | #endregion | 183 | #endregion |
@@ -230,6 +245,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
230 | "[ENTITY TRANSFER MODULE]: Teleport for {0} to {1} within {2}", | 245 | "[ENTITY TRANSFER MODULE]: Teleport for {0} to {1} within {2}", |
231 | sp.Name, position, sp.Scene.RegionInfo.RegionName); | 246 | sp.Name, position, sp.Scene.RegionInfo.RegionName); |
232 | 247 | ||
248 | if (!SetInTransit(sp.UUID)) | ||
249 | { | ||
250 | m_log.DebugFormat( | ||
251 | "[ENTITY TRANSFER MODULE]: Ignoring within region teleport request of {0} {1} to {2} - agent is already in transit.", | ||
252 | sp.Name, sp.UUID, position); | ||
253 | |||
254 | return; | ||
255 | } | ||
256 | |||
233 | // Teleport within the same region | 257 | // Teleport within the same region |
234 | if (IsOutsideRegion(sp.Scene, position) || position.Z < 0) | 258 | if (IsOutsideRegion(sp.Scene, position) || position.Z < 0) |
235 | { | 259 | { |
@@ -258,6 +282,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
258 | position.Z = newPosZ; | 282 | position.Z = newPosZ; |
259 | } | 283 | } |
260 | 284 | ||
285 | UpdateInTransit(sp.UUID, AgentTransferState.Transferring); | ||
286 | |||
261 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 287 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
262 | 288 | ||
263 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 289 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
@@ -265,10 +291,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
265 | sp.Velocity = Vector3.Zero; | 291 | sp.Velocity = Vector3.Zero; |
266 | sp.Teleport(position); | 292 | sp.Teleport(position); |
267 | 293 | ||
294 | UpdateInTransit(sp.UUID, AgentTransferState.ReceivedAtDestination); | ||
295 | |||
268 | foreach (SceneObjectGroup grp in sp.GetAttachments()) | 296 | foreach (SceneObjectGroup grp in sp.GetAttachments()) |
269 | { | 297 | { |
270 | sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT); | 298 | sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT); |
271 | } | 299 | } |
300 | |||
301 | UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); | ||
302 | ResetFromTransit(sp.UUID); | ||
272 | } | 303 | } |
273 | 304 | ||
274 | /// <summary> | 305 | /// <summary> |
@@ -286,7 +317,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
286 | { | 317 | { |
287 | uint x = 0, y = 0; | 318 | uint x = 0, y = 0; |
288 | Utils.LongToUInts(regionHandle, out x, out y); | 319 | Utils.LongToUInts(regionHandle, out x, out y); |
289 | GridRegion reg = m_aScene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); | 320 | GridRegion reg = m_scene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); |
290 | 321 | ||
291 | if (reg != null) | 322 | if (reg != null) |
292 | { | 323 | { |
@@ -366,33 +397,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
366 | ScenePresence sp, GridRegion reg, GridRegion finalDestination, | 397 | ScenePresence sp, GridRegion reg, GridRegion finalDestination, |
367 | Vector3 position, Vector3 lookAt, uint teleportFlags) | 398 | Vector3 position, Vector3 lookAt, uint teleportFlags) |
368 | { | 399 | { |
369 | RegionInfo sourceRegion = sp.Scene.RegionInfo; | 400 | // Record that this agent is in transit so that we can prevent simultaneous requests and do later detection |
370 | 401 | // of whether the destination region completes the teleport. | |
371 | if (!IsWithinMaxTeleportDistance(sourceRegion, finalDestination)) | 402 | if (!SetInTransit(sp.UUID)) |
372 | { | 403 | { |
373 | sp.ControllingClient.SendTeleportFailed( | 404 | m_log.DebugFormat( |
374 | string.Format( | 405 | "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.", |
375 | "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way", | 406 | sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); |
376 | finalDestination.RegionName, finalDestination.RegionCoordX, finalDestination.RegionCoordY, | ||
377 | sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY, | ||
378 | MaxTransferDistance)); | ||
379 | 407 | ||
380 | return; | 408 | return; |
381 | } | 409 | } |
382 | 410 | ||
383 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | ||
384 | |||
385 | if (reg == null || finalDestination == null) | 411 | if (reg == null || finalDestination == null) |
386 | { | 412 | { |
387 | sp.ControllingClient.SendTeleportFailed("Unable to locate destination"); | 413 | sp.ControllingClient.SendTeleportFailed("Unable to locate destination"); |
388 | return; | 414 | ResetFromTransit(sp.UUID); |
389 | } | ||
390 | |||
391 | if (!SetInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this. | ||
392 | { | ||
393 | m_log.DebugFormat( | ||
394 | "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.", | ||
395 | sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); | ||
396 | 415 | ||
397 | return; | 416 | return; |
398 | } | 417 | } |
@@ -402,6 +421,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
402 | sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName, | 421 | sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName, |
403 | reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); | 422 | reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); |
404 | 423 | ||
424 | RegionInfo sourceRegion = sp.Scene.RegionInfo; | ||
425 | |||
426 | if (!IsWithinMaxTeleportDistance(sourceRegion, finalDestination)) | ||
427 | { | ||
428 | sp.ControllingClient.SendTeleportFailed( | ||
429 | string.Format( | ||
430 | "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way", | ||
431 | finalDestination.RegionName, finalDestination.RegionCoordX, finalDestination.RegionCoordY, | ||
432 | sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY, | ||
433 | MaxTransferDistance)); | ||
434 | |||
435 | ResetFromTransit(sp.UUID); | ||
436 | |||
437 | return; | ||
438 | } | ||
439 | |||
405 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | 440 | uint newRegionX = (uint)(reg.RegionHandle >> 40); |
406 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | 441 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); |
407 | uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40); | 442 | uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40); |
@@ -415,15 +450,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
415 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 450 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
416 | if (endPoint != null && endPoint.Address != null) | 451 | if (endPoint != null && endPoint.Address != null) |
417 | { | 452 | { |
418 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 453 | sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); |
419 | // both regions | 454 | ResetFromTransit(sp.UUID); |
420 | if (sp.ParentID != (uint)0) | ||
421 | sp.StandUp(); | ||
422 | 455 | ||
423 | if (!sp.ValidateAttachments()) | 456 | return; |
424 | m_log.DebugFormat( | 457 | } |
425 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for teleport of {0} from {1} to {2}. Continuing.", | 458 | |
426 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName); | 459 | if (!sp.ValidateAttachments()) |
460 | m_log.DebugFormat( | ||
461 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for teleport of {0} from {1} to {2}. Continuing.", | ||
462 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName); | ||
427 | 463 | ||
428 | // if (!sp.ValidateAttachments()) | 464 | // if (!sp.ValidateAttachments()) |
429 | // { | 465 | // { |
@@ -431,212 +467,219 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
431 | // return; | 467 | // return; |
432 | // } | 468 | // } |
433 | 469 | ||
434 | string reason; | 470 | string reason; |
435 | string version; | 471 | string version; |
436 | if (!m_aScene.SimulationService.QueryAccess( | 472 | if (!m_scene.SimulationService.QueryAccess( |
437 | finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason)) | 473 | finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason)) |
438 | { | 474 | { |
439 | sp.ControllingClient.SendTeleportFailed(reason); | 475 | sp.ControllingClient.SendTeleportFailed(reason); |
440 | ResetFromTransit(sp.UUID); | 476 | ResetFromTransit(sp.UUID); |
441 | 477 | ||
442 | m_log.DebugFormat( | 478 | m_log.DebugFormat( |
443 | "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}", | 479 | "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}", |
444 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); | 480 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); |
445 | 481 | ||
446 | return; | 482 | return; |
447 | } | 483 | } |
448 | 484 | ||
449 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); | 485 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); |
450 | 486 | ||
451 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 487 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
488 | // both regions | ||
489 | if (sp.ParentID != (uint)0) | ||
490 | sp.StandUp(); | ||
452 | 491 | ||
453 | // the avatar.Close below will clear the child region list. We need this below for (possibly) | 492 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
454 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). | ||
455 | //List<ulong> childRegions = avatar.KnownRegionHandles; | ||
456 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | ||
457 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail | ||
458 | // once we reach here... | ||
459 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | ||
460 | 493 | ||
461 | string capsPath = String.Empty; | 494 | // the avatar.Close below will clear the child region list. We need this below for (possibly) |
495 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). | ||
496 | //List<ulong> childRegions = avatar.KnownRegionHandles; | ||
497 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | ||
498 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail | ||
499 | // once we reach here... | ||
500 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | ||
462 | 501 | ||
463 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 502 | string capsPath = String.Empty; |
464 | AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); | ||
465 | agentCircuit.startpos = position; | ||
466 | agentCircuit.child = true; | ||
467 | agentCircuit.Appearance = sp.Appearance; | ||
468 | if (currentAgentCircuit != null) | ||
469 | { | ||
470 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
471 | agentCircuit.IPAddress = currentAgentCircuit.IPAddress; | ||
472 | agentCircuit.Viewer = currentAgentCircuit.Viewer; | ||
473 | agentCircuit.Channel = currentAgentCircuit.Channel; | ||
474 | agentCircuit.Mac = currentAgentCircuit.Mac; | ||
475 | agentCircuit.Id0 = currentAgentCircuit.Id0; | ||
476 | } | ||
477 | 503 | ||
478 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | 504 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
479 | { | 505 | AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); |
480 | // brand new agent, let's create a new caps seed | 506 | agentCircuit.startpos = position; |
481 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 507 | agentCircuit.child = true; |
482 | } | 508 | agentCircuit.Appearance = sp.Appearance; |
509 | if (currentAgentCircuit != null) | ||
510 | { | ||
511 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
512 | agentCircuit.IPAddress = currentAgentCircuit.IPAddress; | ||
513 | agentCircuit.Viewer = currentAgentCircuit.Viewer; | ||
514 | agentCircuit.Channel = currentAgentCircuit.Channel; | ||
515 | agentCircuit.Mac = currentAgentCircuit.Mac; | ||
516 | agentCircuit.Id0 = currentAgentCircuit.Id0; | ||
517 | } | ||
483 | 518 | ||
484 | // Let's create an agent there if one doesn't exist yet. | 519 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) |
485 | bool logout = false; | 520 | { |
486 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) | 521 | // brand new agent, let's create a new caps seed |
487 | { | 522 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
488 | sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason)); | 523 | } |
489 | ResetFromTransit(sp.UUID); | ||
490 | 524 | ||
491 | m_log.DebugFormat( | 525 | // Let's create an agent there if one doesn't exist yet. |
492 | "[ENTITY TRANSFER MODULE]: Teleport of {0} from {1} to {2} was refused because {3}", | 526 | bool logout = false; |
493 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); | 527 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) |
528 | { | ||
529 | sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason)); | ||
530 | ResetFromTransit(sp.UUID); | ||
494 | 531 | ||
495 | return; | 532 | m_log.DebugFormat( |
496 | } | 533 | "[ENTITY TRANSFER MODULE]: Teleport of {0} from {1} to {2} was refused because {3}", |
534 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); | ||
535 | |||
536 | return; | ||
537 | } | ||
497 | 538 | ||
498 | // OK, it got this agent. Let's close some child agents | 539 | // Past this point we have to attempt clean up if the teleport fails, so update transfer state. |
499 | sp.CloseChildAgents(newRegionX, newRegionY); | 540 | UpdateInTransit(sp.UUID, AgentTransferState.Transferring); |
500 | 541 | ||
501 | IClientIPEndpoint ipepClient; | 542 | // OK, it got this agent. Let's close some child agents |
502 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | 543 | sp.CloseChildAgents(newRegionX, newRegionY); |
544 | |||
545 | IClientIPEndpoint ipepClient; | ||
546 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
547 | { | ||
548 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); | ||
549 | #region IP Translation for NAT | ||
550 | // Uses ipepClient above | ||
551 | if (sp.ClientView.TryGet(out ipepClient)) | ||
503 | { | 552 | { |
504 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); | 553 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); |
505 | #region IP Translation for NAT | 554 | } |
506 | // Uses ipepClient above | 555 | #endregion |
507 | if (sp.ClientView.TryGet(out ipepClient)) | 556 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); |
508 | { | ||
509 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | ||
510 | } | ||
511 | #endregion | ||
512 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
513 | 557 | ||
514 | if (eq != null) | 558 | if (m_eqModule != null) |
515 | { | 559 | { |
516 | eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); | 560 | m_eqModule.EnableSimulator(destinationHandle, endPoint, sp.UUID); |
517 | 561 | ||
518 | // ES makes the client send a UseCircuitCode message to the destination, | 562 | // ES makes the client send a UseCircuitCode message to the destination, |
519 | // which triggers a bunch of things there. | 563 | // which triggers a bunch of things there. |
520 | // So let's wait | 564 | // So let's wait |
521 | Thread.Sleep(200); | 565 | Thread.Sleep(200); |
522 | 566 | ||
523 | eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); | 567 | m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); |
524 | 568 | ||
525 | } | ||
526 | else | ||
527 | { | ||
528 | sp.ControllingClient.InformClientOfNeighbour(destinationHandle, endPoint); | ||
529 | } | ||
530 | } | 569 | } |
531 | else | 570 | else |
532 | { | 571 | { |
533 | agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); | 572 | sp.ControllingClient.InformClientOfNeighbour(destinationHandle, endPoint); |
534 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
535 | } | 573 | } |
574 | } | ||
575 | else | ||
576 | { | ||
577 | agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); | ||
578 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
579 | } | ||
536 | 580 | ||
537 | // Let's send a full update of the agent. This is a synchronous call. | 581 | // Let's send a full update of the agent. This is a synchronous call. |
538 | AgentData agent = new AgentData(); | 582 | AgentData agent = new AgentData(); |
539 | sp.CopyTo(agent); | 583 | sp.CopyTo(agent); |
540 | agent.Position = position; | 584 | agent.Position = position; |
541 | SetCallbackURL(agent, sp.Scene.RegionInfo); | 585 | SetCallbackURL(agent, sp.Scene.RegionInfo); |
542 | 586 | ||
543 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent..."); | 587 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent..."); |
544 | 588 | ||
545 | if (!UpdateAgent(reg, finalDestination, agent)) | 589 | if (!UpdateAgent(reg, finalDestination, agent)) |
546 | { | 590 | { |
547 | // Region doesn't take it | 591 | // Region doesn't take it |
548 | m_log.WarnFormat( | 592 | m_log.WarnFormat( |
549 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Returning avatar to source region.", | 593 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Returning avatar to source region.", |
550 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); | 594 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
551 | 595 | ||
552 | Fail(sp, finalDestination, logout); | 596 | Fail(sp, finalDestination, logout); |
553 | return; | 597 | return; |
554 | } | 598 | } |
555 | 599 | ||
556 | sp.ControllingClient.SendTeleportProgress(teleportFlags | (uint)TeleportFlags.DisableCancel, "sending_dest"); | 600 | sp.ControllingClient.SendTeleportProgress(teleportFlags | (uint)TeleportFlags.DisableCancel, "sending_dest"); |
557 | 601 | ||
558 | m_log.DebugFormat( | 602 | m_log.DebugFormat( |
559 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}", | 603 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}", |
560 | capsPath, sp.Scene.RegionInfo.RegionName, sp.Name); | 604 | capsPath, sp.Scene.RegionInfo.RegionName, sp.Name); |
561 | 605 | ||
562 | if (eq != null) | 606 | if (m_eqModule != null) |
563 | { | 607 | { |
564 | eq.TeleportFinishEvent(destinationHandle, 13, endPoint, | 608 | m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID); |
565 | 0, teleportFlags, capsPath, sp.UUID); | 609 | } |
566 | } | 610 | else |
567 | else | 611 | { |
568 | { | 612 | sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4, |
569 | sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4, | 613 | teleportFlags, capsPath); |
570 | teleportFlags, capsPath); | 614 | } |
571 | } | ||
572 | 615 | ||
573 | // Let's set this to true tentatively. This does not trigger OnChildAgent | 616 | // Let's set this to true tentatively. This does not trigger OnChildAgent |
574 | sp.IsChildAgent = true; | 617 | sp.IsChildAgent = true; |
575 | 618 | ||
576 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which | 619 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which |
577 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation | 620 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation |
578 | // that the client contacted the destination before we close things here. | 621 | // that the client contacted the destination before we close things here. |
579 | if (EnableWaitForCallbackFromTeleportDest && !WaitForCallback(sp.UUID)) | 622 | if (EnableWaitForCallbackFromTeleportDest && !WaitForCallback(sp.UUID)) |
580 | { | 623 | { |
581 | m_log.WarnFormat( | 624 | m_log.WarnFormat( |
582 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.", | 625 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.", |
583 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); | 626 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
584 | 627 | ||
585 | Fail(sp, finalDestination, logout); | 628 | Fail(sp, finalDestination, logout); |
586 | return; | 629 | return; |
587 | } | 630 | } |
588 | 631 | ||
589 | // For backwards compatibility | 632 | UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); |
590 | if (version == "Unknown" || version == string.Empty) | ||
591 | { | ||
592 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | ||
593 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one..."); | ||
594 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | ||
595 | } | ||
596 | 633 | ||
597 | // May need to logout or other cleanup | 634 | // For backwards compatibility |
598 | AgentHasMovedAway(sp, logout); | 635 | if (version == "Unknown" || version == string.Empty) |
636 | { | ||
637 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | ||
638 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one..."); | ||
639 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | ||
640 | } | ||
599 | 641 | ||
600 | // Well, this is it. The agent is over there. | 642 | // May need to logout or other cleanup |
601 | KillEntity(sp.Scene, sp.LocalId); | 643 | AgentHasMovedAway(sp, logout); |
602 | 644 | ||
603 | // Now let's make it officially a child agent | 645 | // Well, this is it. The agent is over there. |
604 | sp.MakeChildAgent(); | 646 | KillEntity(sp.Scene, sp.LocalId); |
647 | |||
648 | // Now let's make it officially a child agent | ||
649 | sp.MakeChildAgent(); | ||
605 | 650 | ||
606 | // sp.Scene.CleanDroppedAttachments(); | 651 | // sp.Scene.CleanDroppedAttachments(); |
607 | 652 | ||
608 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 653 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
609 | 654 | ||
610 | if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 655 | if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
611 | { | 656 | { |
612 | // We need to delay here because Imprudence viewers, unlike v1 or v3, have a short (<200ms, <500ms) delay before | 657 | // We need to delay here because Imprudence viewers, unlike v1 or v3, have a short (<200ms, <500ms) delay before |
613 | // they regard the new region as the current region after receiving the AgentMovementComplete | 658 | // they regard the new region as the current region after receiving the AgentMovementComplete |
614 | // response. If close is sent before then, it will cause the viewer to quit instead. | 659 | // response. If close is sent before then, it will cause the viewer to quit instead. |
615 | // However, if this delay is longer, then a viewer can teleport back to this region and experience | 660 | // |
616 | // a failure because the old ScenePresence has not yet been cleaned up. | 661 | // This sleep can be increased if necessary. However, whilst it's active, |
617 | Thread.Sleep(2000); | 662 | // an agent cannot teleport back to this region if it has teleported away. |
618 | 663 | Thread.Sleep(2000); | |
619 | sp.Close(); | ||
620 | sp.Scene.IncomingCloseAgent(sp.UUID); | ||
621 | } | ||
622 | else | ||
623 | { | ||
624 | // now we have a child agent in this region. | ||
625 | sp.Reset(); | ||
626 | } | ||
627 | 664 | ||
628 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | 665 | sp.Close(); |
629 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) | 666 | sp.Scene.IncomingCloseAgent(sp.UUID); |
630 | { | ||
631 | m_log.DebugFormat( | ||
632 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", | ||
633 | sp.UUID); | ||
634 | } | ||
635 | } | 667 | } |
636 | else | 668 | else |
637 | { | 669 | { |
638 | sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); | 670 | // now we have a child agent in this region. |
671 | sp.Reset(); | ||
672 | } | ||
673 | |||
674 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
675 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) | ||
676 | { | ||
677 | m_log.DebugFormat( | ||
678 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", | ||
679 | sp.UUID); | ||
639 | } | 680 | } |
681 | |||
682 | ResetFromTransit(sp.UUID); | ||
640 | } | 683 | } |
641 | 684 | ||
642 | protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout) | 685 | protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout) |
@@ -652,7 +695,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
652 | EnableChildAgents(sp); | 695 | EnableChildAgents(sp); |
653 | 696 | ||
654 | // Finally, kill the agent we just created at the destination. | 697 | // Finally, kill the agent we just created at the destination. |
655 | m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); | 698 | m_scene.SimulationService.CloseAgent(finalDestination, sp.UUID); |
656 | 699 | ||
657 | sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); | 700 | sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); |
658 | } | 701 | } |
@@ -660,7 +703,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
660 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) | 703 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) |
661 | { | 704 | { |
662 | logout = false; | 705 | logout = false; |
663 | bool success = m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); | 706 | bool success = m_scene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); |
664 | 707 | ||
665 | if (success) | 708 | if (success) |
666 | sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); | 709 | sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); |
@@ -670,7 +713,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
670 | 713 | ||
671 | protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent) | 714 | protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent) |
672 | { | 715 | { |
673 | return m_aScene.SimulationService.UpdateAgent(finalDestination, agent); | 716 | return m_scene.SimulationService.UpdateAgent(finalDestination, agent); |
674 | } | 717 | } |
675 | 718 | ||
676 | protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) | 719 | protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) |
@@ -722,7 +765,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
722 | return false; | 765 | return false; |
723 | } | 766 | } |
724 | 767 | ||
725 | |||
726 | #endregion | 768 | #endregion |
727 | 769 | ||
728 | #region Landmark Teleport | 770 | #region Landmark Teleport |
@@ -734,7 +776,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
734 | /// <param name="position"></param> | 776 | /// <param name="position"></param> |
735 | public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm) | 777 | public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm) |
736 | { | 778 | { |
737 | GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); | 779 | GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); |
738 | 780 | ||
739 | if (info == null) | 781 | if (info == null) |
740 | { | 782 | { |
@@ -760,8 +802,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
760 | m_log.DebugFormat( | 802 | m_log.DebugFormat( |
761 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); | 803 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); |
762 | 804 | ||
763 | //OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId); | 805 | //OpenSim.Services.Interfaces.PresenceInfo pinfo = m_scene.PresenceService.GetAgent(client.SessionId); |
764 | GridUserInfo uinfo = m_aScene.GridUserService.GetGridUserInfo(client.AgentId.ToString()); | 806 | GridUserInfo uinfo = m_scene.GridUserService.GetGridUserInfo(client.AgentId.ToString()); |
765 | 807 | ||
766 | if (uinfo != null) | 808 | if (uinfo != null) |
767 | { | 809 | { |
@@ -771,7 +813,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
771 | client.SendTeleportFailed("You don't have a home position set."); | 813 | client.SendTeleportFailed("You don't have a home position set."); |
772 | return false; | 814 | return false; |
773 | } | 815 | } |
774 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); | 816 | GridRegion regionInfo = m_scene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); |
775 | if (regionInfo == null) | 817 | if (regionInfo == null) |
776 | { | 818 | { |
777 | // can't find the Home region: Tell viewer and abort | 819 | // can't find the Home region: Tell viewer and abort |
@@ -1016,107 +1058,123 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1016 | ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, | 1058 | ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, |
1017 | bool isFlying, string version) | 1059 | bool isFlying, string version) |
1018 | { | 1060 | { |
1061 | if (neighbourRegion == null) | ||
1062 | return agent; | ||
1063 | |||
1019 | try | 1064 | try |
1020 | { | 1065 | { |
1066 | SetInTransit(agent.UUID); | ||
1067 | |||
1021 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | 1068 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); |
1022 | 1069 | ||
1023 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version); | 1070 | m_log.DebugFormat( |
1071 | "[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", | ||
1072 | agent.Firstname, agent.Lastname, neighbourx, neighboury, version); | ||
1024 | 1073 | ||
1025 | Scene m_scene = agent.Scene; | 1074 | Scene m_scene = agent.Scene; |
1026 | |||
1027 | if (neighbourRegion != null) | ||
1028 | { | ||
1029 | if (!agent.ValidateAttachments()) | ||
1030 | m_log.DebugFormat( | ||
1031 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", | ||
1032 | agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); | ||
1033 | 1075 | ||
1034 | pos = pos + agent.Velocity; | 1076 | if (!agent.ValidateAttachments()) |
1035 | Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); | 1077 | m_log.DebugFormat( |
1078 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", | ||
1079 | agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); | ||
1036 | 1080 | ||
1037 | agent.RemoveFromPhysicalScene(); | 1081 | pos = pos + agent.Velocity; |
1038 | SetInTransit(agent.UUID); | 1082 | Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); |
1039 | 1083 | ||
1040 | AgentData cAgent = new AgentData(); | 1084 | agent.RemoveFromPhysicalScene(); |
1041 | agent.CopyTo(cAgent); | ||
1042 | cAgent.Position = pos; | ||
1043 | if (isFlying) | ||
1044 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
1045 | 1085 | ||
1046 | // We don't need the callback anymnore | 1086 | AgentData cAgent = new AgentData(); |
1047 | cAgent.CallbackURI = String.Empty; | 1087 | agent.CopyTo(cAgent); |
1088 | cAgent.Position = pos; | ||
1089 | if (isFlying) | ||
1090 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
1048 | 1091 | ||
1049 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) | 1092 | // We don't need the callback anymnore |
1050 | { | 1093 | cAgent.CallbackURI = String.Empty; |
1051 | // region doesn't take it | ||
1052 | ReInstantiateScripts(agent); | ||
1053 | agent.AddToPhysicalScene(isFlying); | ||
1054 | ResetFromTransit(agent.UUID); | ||
1055 | return agent; | ||
1056 | } | ||
1057 | |||
1058 | //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | ||
1059 | agent.ControllingClient.RequestClientInfo(); | ||
1060 | |||
1061 | //m_log.Debug("BEFORE CROSS"); | ||
1062 | //Scene.DumpChildrenSeeds(UUID); | ||
1063 | //DumpKnownRegions(); | ||
1064 | string agentcaps; | ||
1065 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) | ||
1066 | { | ||
1067 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", | ||
1068 | neighbourRegion.RegionHandle); | ||
1069 | return agent; | ||
1070 | } | ||
1071 | // No turning back | ||
1072 | agent.IsChildAgent = true; | ||
1073 | 1094 | ||
1074 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); | 1095 | // Beyond this point, extra cleanup is needed beyond removing transit state |
1075 | 1096 | UpdateInTransit(agent.UUID, AgentTransferState.Transferring); | |
1076 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | ||
1077 | 1097 | ||
1078 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 1098 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) |
1079 | if (eq != null) | 1099 | { |
1080 | { | 1100 | // region doesn't take it |
1081 | eq.CrossRegion(neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint, | 1101 | UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); |
1082 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
1083 | } | ||
1084 | else | ||
1085 | { | ||
1086 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
1087 | capsPath); | ||
1088 | } | ||
1089 | 1102 | ||
1090 | // SUCCESS! | 1103 | ReInstantiateScripts(agent); |
1091 | agent.MakeChildAgent(); | 1104 | agent.AddToPhysicalScene(isFlying); |
1092 | ResetFromTransit(agent.UUID); | 1105 | ResetFromTransit(agent.UUID); |
1093 | 1106 | ||
1094 | // now we have a child agent in this region. Request all interesting data about other (root) agents | 1107 | return agent; |
1095 | agent.SendOtherAgentsAvatarDataToMe(); | 1108 | } |
1096 | agent.SendOtherAgentsAppearanceToMe(); | ||
1097 | 1109 | ||
1098 | // Backwards compatibility. Best effort | 1110 | //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); |
1099 | if (version == "Unknown" || version == string.Empty) | 1111 | agent.ControllingClient.RequestClientInfo(); |
1100 | { | ||
1101 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); | ||
1102 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback | ||
1103 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1104 | } | ||
1105 | 1112 | ||
1113 | //m_log.Debug("BEFORE CROSS"); | ||
1114 | //Scene.DumpChildrenSeeds(UUID); | ||
1115 | //DumpKnownRegions(); | ||
1116 | string agentcaps; | ||
1117 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) | ||
1118 | { | ||
1119 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", | ||
1120 | neighbourRegion.RegionHandle); | ||
1121 | return agent; | ||
1122 | } | ||
1123 | // No turning back | ||
1124 | agent.IsChildAgent = true; | ||
1106 | 1125 | ||
1107 | // Next, let's close the child agent connections that are too far away. | 1126 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); |
1108 | agent.CloseChildAgents(neighbourx, neighboury); | 1127 | |
1109 | 1128 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | |
1110 | AgentHasMovedAway(agent, false); | 1129 | |
1111 | 1130 | if (m_eqModule != null) | |
1112 | // the user may change their profile information in other region, | 1131 | { |
1113 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 1132 | m_eqModule.CrossRegion( |
1114 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | 1133 | neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint, |
1115 | if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | 1134 | capsPath, agent.UUID, agent.ControllingClient.SessionId); |
1116 | { | 1135 | } |
1117 | m_log.DebugFormat( | 1136 | else |
1118 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); | 1137 | { |
1119 | } | 1138 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, |
1139 | capsPath); | ||
1140 | } | ||
1141 | |||
1142 | // SUCCESS! | ||
1143 | UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); | ||
1144 | |||
1145 | // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. | ||
1146 | UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | ||
1147 | |||
1148 | agent.MakeChildAgent(); | ||
1149 | |||
1150 | // FIXME: Possibly this should occur lower down after other commands to close other agents, | ||
1151 | // but not sure yet what the side effects would be. | ||
1152 | ResetFromTransit(agent.UUID); | ||
1153 | |||
1154 | // now we have a child agent in this region. Request all interesting data about other (root) agents | ||
1155 | agent.SendOtherAgentsAvatarDataToMe(); | ||
1156 | agent.SendOtherAgentsAppearanceToMe(); | ||
1157 | |||
1158 | // Backwards compatibility. Best effort | ||
1159 | if (version == "Unknown" || version == string.Empty) | ||
1160 | { | ||
1161 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); | ||
1162 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback | ||
1163 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1164 | } | ||
1165 | |||
1166 | // Next, let's close the child agent connections that are too far away. | ||
1167 | agent.CloseChildAgents(neighbourx, neighboury); | ||
1168 | |||
1169 | AgentHasMovedAway(agent, false); | ||
1170 | |||
1171 | // the user may change their profile information in other region, | ||
1172 | // so the userinfo in UserProfileCache is not reliable any more, delete it | ||
1173 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
1174 | if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | ||
1175 | { | ||
1176 | m_log.DebugFormat( | ||
1177 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); | ||
1120 | } | 1178 | } |
1121 | 1179 | ||
1122 | //m_log.Debug("AFTER CROSS"); | 1180 | //m_log.Debug("AFTER CROSS"); |
@@ -1128,11 +1186,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1128 | m_log.ErrorFormat( | 1186 | m_log.ErrorFormat( |
1129 | "[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}", | 1187 | "[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}", |
1130 | agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace); | 1188 | agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace); |
1189 | |||
1190 | // TODO: Might be worth attempting other restoration here such as reinstantiation of scripts, etc. | ||
1131 | } | 1191 | } |
1132 | 1192 | ||
1133 | return agent; | 1193 | return agent; |
1134 | } | 1194 | } |
1135 | 1195 | ||
1136 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) | 1196 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) |
1137 | { | 1197 | { |
1138 | CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; | 1198 | CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; |
@@ -1431,8 +1491,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1431 | 1491 | ||
1432 | if (regionAccepted && newAgent) | 1492 | if (regionAccepted && newAgent) |
1433 | { | 1493 | { |
1434 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 1494 | if (m_eqModule != null) |
1435 | if (eq != null) | ||
1436 | { | 1495 | { |
1437 | #region IP Translation for NAT | 1496 | #region IP Translation for NAT |
1438 | IClientIPEndpoint ipepClient; | 1497 | IClientIPEndpoint ipepClient; |
@@ -1446,8 +1505,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1446 | "and EstablishAgentCommunication with seed cap {4}", | 1505 | "and EstablishAgentCommunication with seed cap {4}", |
1447 | scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath); | 1506 | scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath); |
1448 | 1507 | ||
1449 | eq.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID); | 1508 | m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID); |
1450 | eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); | 1509 | m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); |
1451 | } | 1510 | } |
1452 | else | 1511 | else |
1453 | { | 1512 | { |
@@ -1573,8 +1632,37 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1573 | #region Agent Arrived | 1632 | #region Agent Arrived |
1574 | public void AgentArrivedAtDestination(UUID id) | 1633 | public void AgentArrivedAtDestination(UUID id) |
1575 | { | 1634 | { |
1576 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent {0} released", id); | 1635 | lock (m_agentsInTransit) |
1577 | ResetFromTransit(id); | 1636 | { |
1637 | if (!m_agentsInTransit.ContainsKey(id)) | ||
1638 | { | ||
1639 | m_log.WarnFormat( | ||
1640 | "[ENTITY TRANSFER MODULE]: Region {0} received notification of arrival in destination scene of agent {1} but no teleport request is active", | ||
1641 | m_scene.RegionInfo.RegionName, id); | ||
1642 | |||
1643 | return; | ||
1644 | } | ||
1645 | |||
1646 | AgentTransferState currentState = m_agentsInTransit[id]; | ||
1647 | |||
1648 | if (currentState == AgentTransferState.ReceivedAtDestination) | ||
1649 | { | ||
1650 | // An anomoly but don't make this an outright failure - destination region could be overzealous in sending notification. | ||
1651 | m_log.WarnFormat( | ||
1652 | "[ENTITY TRANSFER MODULE]: Region {0} received notification of arrival in destination scene of agent {1} but notification has already previously been received", | ||
1653 | m_scene.RegionInfo.RegionName, id); | ||
1654 | } | ||
1655 | else if (currentState != AgentTransferState.Transferring) | ||
1656 | { | ||
1657 | m_log.ErrorFormat( | ||
1658 | "[ENTITY TRANSFER MODULE]: Region {0} received notification of arrival in destination scene of agent {1} but agent is in transfer state {2}", | ||
1659 | m_scene.RegionInfo.RegionName, id, currentState); | ||
1660 | |||
1661 | return; | ||
1662 | } | ||
1663 | |||
1664 | m_agentsInTransit[id] = AgentTransferState.ReceivedAtDestination; | ||
1665 | } | ||
1578 | } | 1666 | } |
1579 | 1667 | ||
1580 | #endregion | 1668 | #endregion |
@@ -1845,8 +1933,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1845 | //// And the new channel... | 1933 | //// And the new channel... |
1846 | //if (m_interregionCommsOut != null) | 1934 | //if (m_interregionCommsOut != null) |
1847 | // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); | 1935 | // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); |
1848 | if (m_aScene.SimulationService != null) | 1936 | if (m_scene.SimulationService != null) |
1849 | successYN = m_aScene.SimulationService.CreateObject(destination, newPosition, grp, true); | 1937 | successYN = m_scene.SimulationService.CreateObject(destination, newPosition, grp, true); |
1850 | 1938 | ||
1851 | if (successYN) | 1939 | if (successYN) |
1852 | { | 1940 | { |
@@ -1925,10 +2013,29 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1925 | 2013 | ||
1926 | #region Misc | 2014 | #region Misc |
1927 | 2015 | ||
1928 | protected bool WaitForCallback(UUID id) | 2016 | private bool WaitForCallback(UUID id) |
1929 | { | 2017 | { |
2018 | lock (m_agentsInTransit) | ||
2019 | { | ||
2020 | if (!IsInTransit(id)) | ||
2021 | throw new Exception( | ||
2022 | string.Format( | ||
2023 | "Asked to wait for destination callback for agent with ID {0} but it is not in transit")); | ||
2024 | |||
2025 | AgentTransferState currentState = m_agentsInTransit[id]; | ||
2026 | |||
2027 | if (currentState != AgentTransferState.Transferring && currentState != AgentTransferState.ReceivedAtDestination) | ||
2028 | throw new Exception( | ||
2029 | string.Format( | ||
2030 | "Asked to wait for destination callback for agent with ID {0} but it is in state {1}", | ||
2031 | currentState)); | ||
2032 | } | ||
2033 | |||
1930 | int count = 200; | 2034 | int count = 200; |
1931 | while (m_agentsInTransit.Contains(id) && count-- > 0) | 2035 | |
2036 | // There should be no race condition here since no other code should be removing the agent transfer or | ||
2037 | // changing the state to another other than Transferring => ReceivedAtDestination. | ||
2038 | while (m_agentsInTransit[id] != AgentTransferState.ReceivedAtDestination && count-- > 0) | ||
1932 | { | 2039 | { |
1933 | // m_log.Debug(" >>> Waiting... " + count); | 2040 | // m_log.Debug(" >>> Waiting... " + count); |
1934 | Thread.Sleep(100); | 2041 | Thread.Sleep(100); |
@@ -1938,17 +2045,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1938 | } | 2045 | } |
1939 | 2046 | ||
1940 | /// <summary> | 2047 | /// <summary> |
1941 | /// Set that an agent is in the process of being teleported. | 2048 | /// Set that an agent is in transit. |
1942 | /// </summary> | 2049 | /// </summary> |
1943 | /// <param name='id'>The ID of the agent being teleported</param> | 2050 | /// <param name='id'>The ID of the agent being teleported</param> |
1944 | /// <returns>true if the agent was not already in transit, false if it was</returns> | 2051 | /// <returns>true if the agent was not already in transit, false if it was</returns> |
1945 | protected bool SetInTransit(UUID id) | 2052 | private bool SetInTransit(UUID id) |
1946 | { | 2053 | { |
1947 | lock (m_agentsInTransit) | 2054 | lock (m_agentsInTransit) |
1948 | { | 2055 | { |
1949 | if (!m_agentsInTransit.Contains(id)) | 2056 | if (!m_agentsInTransit.ContainsKey(id)) |
1950 | { | 2057 | { |
1951 | m_agentsInTransit.Add(id); | 2058 | m_agentsInTransit[id] = AgentTransferState.Preparing; |
1952 | return true; | 2059 | return true; |
1953 | } | 2060 | } |
1954 | } | 2061 | } |
@@ -1957,34 +2064,87 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1957 | } | 2064 | } |
1958 | 2065 | ||
1959 | /// <summary> | 2066 | /// <summary> |
1960 | /// Show whether the given agent is being teleported. | 2067 | /// Updates the state of an agent that is already in transit. |
1961 | /// </summary> | 2068 | /// </summary> |
1962 | /// <returns>true if the agent is in the process of being teleported, false otherwise.</returns> | 2069 | /// <param name='id'></param> |
1963 | /// <param name='id'>The agent ID</para></param> | 2070 | /// <param name='newState'></param> |
1964 | protected bool IsInTransit(UUID id) | 2071 | /// <returns></returns> |
2072 | /// <exception cref='Exception'>Illegal transitions will throw an Exception</exception> | ||
2073 | private void UpdateInTransit(UUID id, AgentTransferState newState) | ||
2074 | { | ||
2075 | lock (m_agentsInTransit) | ||
2076 | { | ||
2077 | // Illegal to try and update an agent that's not actually in transit. | ||
2078 | if (!m_agentsInTransit.ContainsKey(id)) | ||
2079 | throw new Exception(string.Format("Agent with ID {0} is not registered as in transit", id)); | ||
2080 | |||
2081 | AgentTransferState oldState = m_agentsInTransit[id]; | ||
2082 | |||
2083 | bool transitionOkay = false; | ||
2084 | |||
2085 | if (newState == AgentTransferState.CleaningUp && oldState != AgentTransferState.CleaningUp) | ||
2086 | transitionOkay = true; | ||
2087 | else if (newState == AgentTransferState.Transferring && oldState == AgentTransferState.Preparing) | ||
2088 | transitionOkay = true; | ||
2089 | else if (newState == AgentTransferState.ReceivedAtDestination && oldState == AgentTransferState.Transferring) | ||
2090 | transitionOkay = true; | ||
2091 | |||
2092 | if (transitionOkay) | ||
2093 | m_agentsInTransit[id] = newState; | ||
2094 | else | ||
2095 | throw new Exception( | ||
2096 | string.Format( | ||
2097 | "Agent with ID {0} is not allowed to move from old transit state {1} to new state {2}", | ||
2098 | id, oldState, newState)); | ||
2099 | } | ||
2100 | } | ||
2101 | |||
2102 | public bool IsInTransit(UUID id) | ||
1965 | { | 2103 | { |
1966 | lock (m_agentsInTransit) | 2104 | lock (m_agentsInTransit) |
1967 | return m_agentsInTransit.Contains(id); | 2105 | return m_agentsInTransit.ContainsKey(id); |
1968 | } | 2106 | } |
1969 | 2107 | ||
1970 | /// <summary> | 2108 | /// <summary> |
1971 | /// Set that an agent is no longer being teleported. | 2109 | /// Removes an agent from the transit state machine. |
1972 | /// </summary> | 2110 | /// </summary> |
1973 | /// <returns></returns> | 2111 | /// <param name='id'></param> |
1974 | /// <param name='id'> | 2112 | /// <returns>true if the agent was flagged as being teleported when this method was called, false otherwise</returns> |
1975 | /// true if the agent was flagged as being teleported when this method was called, false otherwise | 2113 | private bool ResetFromTransit(UUID id) |
1976 | /// </param> | ||
1977 | protected bool ResetFromTransit(UUID id) | ||
1978 | { | 2114 | { |
1979 | lock (m_agentsInTransit) | 2115 | lock (m_agentsInTransit) |
1980 | { | 2116 | { |
1981 | if (m_agentsInTransit.Contains(id)) | 2117 | if (m_agentsInTransit.ContainsKey(id)) |
1982 | { | 2118 | { |
2119 | AgentTransferState state = m_agentsInTransit[id]; | ||
2120 | |||
2121 | if (state == AgentTransferState.Transferring || state == AgentTransferState.ReceivedAtDestination) | ||
2122 | { | ||
2123 | // FIXME: For now, we allow exit from any state since a thrown exception in teleport is now guranteed | ||
2124 | // to be handled properly - ResetFromTransit() could be invoked at any step along the process | ||
2125 | m_log.WarnFormat( | ||
2126 | "[ENTITY TRANSFER MODULE]: Agent with ID should not exit directly from state {1}, should go to {2} state first", | ||
2127 | state, AgentTransferState.CleaningUp); | ||
2128 | |||
2129 | // throw new Exception( | ||
2130 | // "Agent with ID {0} cannot exit directly from state {1}, it must go to {2} state first", | ||
2131 | // state, AgentTransferState.CleaningUp); | ||
2132 | } | ||
2133 | |||
1983 | m_agentsInTransit.Remove(id); | 2134 | m_agentsInTransit.Remove(id); |
2135 | |||
2136 | m_log.DebugFormat( | ||
2137 | "[ENTITY TRANSFER MODULE]: Agent {0} cleared from transit in {1}", | ||
2138 | id, m_scene.RegionInfo.RegionName); | ||
2139 | |||
1984 | return true; | 2140 | return true; |
1985 | } | 2141 | } |
1986 | } | 2142 | } |
1987 | 2143 | ||
2144 | m_log.WarnFormat( | ||
2145 | "[ENTITY TRANSFER MODULE]: Agent {0} requested to clear from transit in {1} but was already cleared.", | ||
2146 | id, m_scene.RegionInfo.RegionName); | ||
2147 | |||
1988 | return false; | 2148 | return false; |
1989 | } | 2149 | } |
1990 | 2150 | ||
@@ -2015,4 +2175,4 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2015 | #endregion | 2175 | #endregion |
2016 | 2176 | ||
2017 | } | 2177 | } |
2018 | } \ No newline at end of file | 2178 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 6e27299..44ea2b1 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -45,11 +45,11 @@ using Nini.Config; | |||
45 | 45 | ||
46 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | 46 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer |
47 | { | 47 | { |
48 | public class HGEntityTransferModule : EntityTransferModule, ISharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule | 48 | public class HGEntityTransferModule |
49 | : EntityTransferModule, INonSharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule | ||
49 | { | 50 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 52 | ||
52 | private bool m_Initialized = false; | ||
53 | private int m_levelHGTeleport = 0; | 53 | private int m_levelHGTeleport = 0; |
54 | 54 | ||
55 | private GatekeeperServiceConnector m_GatekeeperConnector; | 55 | private GatekeeperServiceConnector m_GatekeeperConnector; |
@@ -64,6 +64,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
64 | public override void Initialise(IConfigSource source) | 64 | public override void Initialise(IConfigSource source) |
65 | { | 65 | { |
66 | IConfig moduleConfig = source.Configs["Modules"]; | 66 | IConfig moduleConfig = source.Configs["Modules"]; |
67 | |||
67 | if (moduleConfig != null) | 68 | if (moduleConfig != null) |
68 | { | 69 | { |
69 | string name = moduleConfig.GetString("EntityTransferModule", ""); | 70 | string name = moduleConfig.GetString("EntityTransferModule", ""); |
@@ -82,10 +83,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
82 | public override void AddRegion(Scene scene) | 83 | public override void AddRegion(Scene scene) |
83 | { | 84 | { |
84 | base.AddRegion(scene); | 85 | base.AddRegion(scene); |
86 | |||
85 | if (m_Enabled) | 87 | if (m_Enabled) |
86 | { | ||
87 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); | 88 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); |
88 | } | ||
89 | } | 89 | } |
90 | 90 | ||
91 | protected override void OnNewClient(IClientAPI client) | 91 | protected override void OnNewClient(IClientAPI client) |
@@ -98,33 +98,28 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
98 | public override void RegionLoaded(Scene scene) | 98 | public override void RegionLoaded(Scene scene) |
99 | { | 99 | { |
100 | base.RegionLoaded(scene); | 100 | base.RegionLoaded(scene); |
101 | if (m_Enabled) | ||
102 | if (!m_Initialized) | ||
103 | { | ||
104 | m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); | ||
105 | m_Initialized = true; | ||
106 | |||
107 | } | ||
108 | 101 | ||
102 | if (m_Enabled) | ||
103 | m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); | ||
109 | } | 104 | } |
105 | |||
110 | public override void RemoveRegion(Scene scene) | 106 | public override void RemoveRegion(Scene scene) |
111 | { | 107 | { |
112 | base.AddRegion(scene); | 108 | base.AddRegion(scene); |
109 | |||
113 | if (m_Enabled) | 110 | if (m_Enabled) |
114 | { | ||
115 | scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); | 111 | scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); |
116 | } | ||
117 | } | 112 | } |
118 | 113 | ||
119 | |||
120 | #endregion | 114 | #endregion |
121 | 115 | ||
122 | #region HG overrides of IEntiryTransferModule | 116 | #region HG overrides of IEntiryTransferModule |
123 | 117 | ||
124 | protected override GridRegion GetFinalDestination(GridRegion region) | 118 | protected override GridRegion GetFinalDestination(GridRegion region) |
125 | { | 119 | { |
126 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, region.RegionID); | 120 | int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, region.RegionID); |
127 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); | 121 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); |
122 | |||
128 | if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | 123 | if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) |
129 | { | 124 | { |
130 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); | 125 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); |
@@ -135,6 +130,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
135 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion to Gatekeeper {0} failed", region.ServerURI); | 130 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion to Gatekeeper {0} failed", region.ServerURI); |
136 | return real_destination; | 131 | return real_destination; |
137 | } | 132 | } |
133 | |||
138 | return region; | 134 | return region; |
139 | } | 135 | } |
140 | 136 | ||
@@ -143,7 +139,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
143 | if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 139 | if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
144 | return true; | 140 | return true; |
145 | 141 | ||
146 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); | 142 | int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, reg.RegionID); |
147 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | 143 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) |
148 | return true; | 144 | return true; |
149 | 145 | ||
@@ -156,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
156 | if (logout) | 152 | if (logout) |
157 | { | 153 | { |
158 | // Log them out of this grid | 154 | // Log them out of this grid |
159 | m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 155 | m_scene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
160 | } | 156 | } |
161 | } | 157 | } |
162 | 158 | ||
@@ -165,7 +161,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
165 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI); | 161 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI); |
166 | reason = string.Empty; | 162 | reason = string.Empty; |
167 | logout = false; | 163 | logout = false; |
168 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); | 164 | int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, reg.RegionID); |
169 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | 165 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) |
170 | { | 166 | { |
171 | // this user is going to another grid | 167 | // this user is going to another grid |
@@ -210,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
210 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); | 206 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); |
211 | 207 | ||
212 | // Let's find out if this is a foreign user or a local user | 208 | // Let's find out if this is a foreign user or a local user |
213 | IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>(); | 209 | IUserManagement uMan = m_scene.RequestModuleInterface<IUserManagement>(); |
214 | if (uMan != null && uMan.IsLocalGridUser(id)) | 210 | if (uMan != null && uMan.IsLocalGridUser(id)) |
215 | { | 211 | { |
216 | // local grid user | 212 | // local grid user |
@@ -265,19 +261,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
265 | { | 261 | { |
266 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}", | 262 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}", |
267 | (lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position); | 263 | (lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position); |
264 | |||
268 | if (lm.Gatekeeper == string.Empty) | 265 | if (lm.Gatekeeper == string.Empty) |
269 | { | 266 | { |
270 | base.RequestTeleportLandmark(remoteClient, lm); | 267 | base.RequestTeleportLandmark(remoteClient, lm); |
271 | return; | 268 | return; |
272 | } | 269 | } |
273 | 270 | ||
274 | GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); | 271 | GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); |
275 | 272 | ||
276 | // Local region? | 273 | // Local region? |
277 | if (info != null) | 274 | if (info != null) |
278 | { | 275 | { |
279 | ((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position, | 276 | ((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position, |
280 | Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); | 277 | Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); |
278 | |||
281 | return; | 279 | return; |
282 | } | 280 | } |
283 | else | 281 | else |
@@ -288,6 +286,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
288 | GridRegion gatekeeper = new GridRegion(); | 286 | GridRegion gatekeeper = new GridRegion(); |
289 | gatekeeper.ServerURI = lm.Gatekeeper; | 287 | gatekeeper.ServerURI = lm.Gatekeeper; |
290 | GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID)); | 288 | GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID)); |
289 | |||
291 | if (finalDestination != null) | 290 | if (finalDestination != null) |
292 | { | 291 | { |
293 | ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId); | 292 | ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId); |
@@ -317,8 +316,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
317 | IUserAgentService security = new UserAgentServiceConnector(url); | 316 | IUserAgentService security = new UserAgentServiceConnector(url); |
318 | return security.VerifyClient(aCircuit.SessionID, token); | 317 | return security.VerifyClient(aCircuit.SessionID, token); |
319 | } | 318 | } |
320 | else | 319 | else |
321 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!", aCircuit.firstname, aCircuit.lastname); | 320 | { |
321 | m_log.DebugFormat( | ||
322 | "[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!", | ||
323 | aCircuit.firstname, aCircuit.lastname); | ||
324 | } | ||
322 | 325 | ||
323 | return false; | 326 | return false; |
324 | } | 327 | } |
@@ -335,8 +338,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
335 | } | 338 | } |
336 | 339 | ||
337 | // Let's find out if this is a foreign user or a local user | 340 | // Let's find out if this is a foreign user or a local user |
338 | IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>(); | 341 | IUserManagement uMan = m_scene.RequestModuleInterface<IUserManagement>(); |
339 | UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId); | 342 | // UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, obj.AgentId); |
340 | if (uMan != null && uMan.IsLocalGridUser(obj.AgentId)) | 343 | if (uMan != null && uMan.IsLocalGridUser(obj.AgentId)) |
341 | { | 344 | { |
342 | // local grid user | 345 | // local grid user |
@@ -359,7 +362,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
359 | 362 | ||
360 | #endregion | 363 | #endregion |
361 | 364 | ||
362 | |||
363 | private GridRegion MakeRegion(AgentCircuitData aCircuit) | 365 | private GridRegion MakeRegion(AgentCircuitData aCircuit) |
364 | { | 366 | { |
365 | GridRegion region = new GridRegion(); | 367 | GridRegion region = new GridRegion(); |
@@ -376,6 +378,5 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
376 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); | 378 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); |
377 | return region; | 379 | return region; |
378 | } | 380 | } |
379 | |||
380 | } | 381 | } |
381 | } | 382 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index a71584a..cf72b58 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -364,8 +364,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
364 | { | 364 | { |
365 | m_log.DebugFormat("[HG INVENTORY ACCESS MODULE]: Changing root inventory for user {0}", client.Name); | 365 | m_log.DebugFormat("[HG INVENTORY ACCESS MODULE]: Changing root inventory for user {0}", client.Name); |
366 | InventoryCollection content = m_Scene.InventoryService.GetFolderContent(client.AgentId, root.ID); | 366 | InventoryCollection content = m_Scene.InventoryService.GetFolderContent(client.AgentId, root.ID); |
367 | List<UUID> fids = new List<UUID>(); | 367 | |
368 | List<UUID> iids = new List<UUID>(); | ||
369 | List<InventoryFolderBase> keep = new List<InventoryFolderBase>(); | 368 | List<InventoryFolderBase> keep = new List<InventoryFolderBase>(); |
370 | 369 | ||
371 | foreach (InventoryFolderBase f in content.Folders) | 370 | foreach (InventoryFolderBase f in content.Folders) |
@@ -395,4 +394,4 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
395 | 394 | ||
396 | #endregion | 395 | #endregion |
397 | } | 396 | } |
398 | } | 397 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index ee9961f..31820e0 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -175,7 +175,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
175 | sbyte assetType, | 175 | sbyte assetType, |
176 | byte wearableType, uint nextOwnerMask, int creationDate) | 176 | byte wearableType, uint nextOwnerMask, int creationDate) |
177 | { | 177 | { |
178 | m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item {0} in folder {1}", name, folderID); | 178 | m_log.DebugFormat("[INVENTORY ACCESS MODULE]: Received request to create inventory item {0} in folder {1}", name, folderID); |
179 | 179 | ||
180 | if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) | 180 | if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) |
181 | return; | 181 | return; |
@@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
210 | else | 210 | else |
211 | { | 211 | { |
212 | m_log.ErrorFormat( | 212 | m_log.ErrorFormat( |
213 | "ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem", | 213 | "[INVENTORY ACCESS MODULE]: ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem", |
214 | remoteClient.AgentId); | 214 | remoteClient.AgentId); |
215 | } | 215 | } |
216 | } | 216 | } |
@@ -288,16 +288,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
288 | else | 288 | else |
289 | { | 289 | { |
290 | m_log.ErrorFormat( | 290 | m_log.ErrorFormat( |
291 | "[AGENT INVENTORY]: Could not find item {0} for caps inventory update", | 291 | "[INVENTORY ACCESS MODULE]: Could not find item {0} for caps inventory update", |
292 | itemID); | 292 | itemID); |
293 | } | 293 | } |
294 | 294 | ||
295 | return UUID.Zero; | 295 | return UUID.Zero; |
296 | } | 296 | } |
297 | 297 | ||
298 | public virtual UUID CopyToInventory(DeRezAction action, UUID folderID, | 298 | public virtual List<InventoryItemBase> CopyToInventory( |
299 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) | 299 | DeRezAction action, UUID folderID, |
300 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment) | ||
300 | { | 301 | { |
302 | List<InventoryItemBase> copiedItems = new List<InventoryItemBase>(); | ||
303 | |||
301 | Dictionary<UUID, List<SceneObjectGroup>> bundlesToCopy = new Dictionary<UUID, List<SceneObjectGroup>>(); | 304 | Dictionary<UUID, List<SceneObjectGroup>> bundlesToCopy = new Dictionary<UUID, List<SceneObjectGroup>>(); |
302 | 305 | ||
303 | if (CoalesceMultipleObjectsToInventory) | 306 | if (CoalesceMultipleObjectsToInventory) |
@@ -324,16 +327,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
324 | } | 327 | } |
325 | } | 328 | } |
326 | 329 | ||
327 | // This is method scoped and will be returned. It will be the | 330 | // m_log.DebugFormat( |
328 | // last created asset id | 331 | // "[INVENTORY ACCESS MODULE]: Copying {0} object bundles to folder {1} action {2} for {3}", |
329 | UUID assetID = UUID.Zero; | 332 | // bundlesToCopy.Count, folderID, action, remoteClient.Name); |
330 | 333 | ||
331 | // Each iteration is really a separate asset being created, | 334 | // Each iteration is really a separate asset being created, |
332 | // with distinct destinations as well. | 335 | // with distinct destinations as well. |
333 | foreach (List<SceneObjectGroup> bundle in bundlesToCopy.Values) | 336 | foreach (List<SceneObjectGroup> bundle in bundlesToCopy.Values) |
334 | assetID = CopyBundleToInventory(action, folderID, bundle, remoteClient); | 337 | copiedItems.Add(CopyBundleToInventory(action, folderID, bundle, remoteClient, asAttachment)); |
335 | 338 | ||
336 | return assetID; | 339 | return copiedItems; |
337 | } | 340 | } |
338 | 341 | ||
339 | /// <summary> | 342 | /// <summary> |
@@ -344,12 +347,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
344 | /// <param name="folderID"></param> | 347 | /// <param name="folderID"></param> |
345 | /// <param name="objlist"></param> | 348 | /// <param name="objlist"></param> |
346 | /// <param name="remoteClient"></param> | 349 | /// <param name="remoteClient"></param> |
347 | /// <returns></returns> | 350 | /// <param name="asAttachment">Should be true if the bundle is being copied as an attachment. This prevents |
348 | protected UUID CopyBundleToInventory( | 351 | /// attempted serialization of any script state which would abort any operating scripts.</param> |
349 | DeRezAction action, UUID folderID, List<SceneObjectGroup> objlist, IClientAPI remoteClient) | 352 | /// <returns>The inventory item created by the copy</returns> |
353 | protected InventoryItemBase CopyBundleToInventory( | ||
354 | DeRezAction action, UUID folderID, List<SceneObjectGroup> objlist, IClientAPI remoteClient, | ||
355 | bool asAttachment) | ||
350 | { | 356 | { |
351 | UUID assetID = UUID.Zero; | ||
352 | |||
353 | CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); | 357 | CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); |
354 | Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); | 358 | Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); |
355 | 359 | ||
@@ -401,18 +405,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
401 | 405 | ||
402 | string itemXml; | 406 | string itemXml; |
403 | 407 | ||
408 | // If we're being called from a script, then trying to serialize that same script's state will not complete | ||
409 | // in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if | ||
410 | // the client/server crashes rather than logging out normally, the attachment's scripts will resume | ||
411 | // without state on relog. Arguably, this is what we want anyway. | ||
404 | if (objlist.Count > 1) | 412 | if (objlist.Count > 1) |
405 | itemXml = CoalescedSceneObjectsSerializer.ToXml(coa); | 413 | itemXml = CoalescedSceneObjectsSerializer.ToXml(coa, !asAttachment); |
406 | else | 414 | else |
407 | itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]); | 415 | itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0], !asAttachment); |
408 | 416 | ||
409 | // Restore the position of each group now that it has been stored to inventory. | 417 | // Restore the position of each group now that it has been stored to inventory. |
410 | foreach (SceneObjectGroup objectGroup in objlist) | 418 | foreach (SceneObjectGroup objectGroup in objlist) |
411 | objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; | 419 | objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; |
412 | 420 | ||
413 | InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); | 421 | InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); |
422 | |||
423 | // m_log.DebugFormat( | ||
424 | // "[INVENTORY ACCESS MODULE]: Created item is {0}", | ||
425 | // item != null ? item.ID.ToString() : "NULL"); | ||
426 | |||
414 | if (item == null) | 427 | if (item == null) |
415 | return UUID.Zero; | 428 | return null; |
416 | 429 | ||
417 | // Can't know creator is the same, so null it in inventory | 430 | // Can't know creator is the same, so null it in inventory |
418 | if (objlist.Count > 1) | 431 | if (objlist.Count > 1) |
@@ -422,7 +435,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
422 | } | 435 | } |
423 | else | 436 | else |
424 | { | 437 | { |
425 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | 438 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); |
439 | item.CreatorData = objlist[0].RootPart.CreatorData; | ||
426 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | 440 | item.SaleType = objlist[0].RootPart.ObjectSaleType; |
427 | item.SalePrice = objlist[0].RootPart.SalePrice; | 441 | item.SalePrice = objlist[0].RootPart.SalePrice; |
428 | } | 442 | } |
@@ -435,8 +449,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
435 | objlist[0].OwnerID.ToString()); | 449 | objlist[0].OwnerID.ToString()); |
436 | m_Scene.AssetService.Store(asset); | 450 | m_Scene.AssetService.Store(asset); |
437 | 451 | ||
438 | item.AssetID = asset.FullID; | 452 | item.AssetID = asset.FullID; |
439 | assetID = asset.FullID; | ||
440 | 453 | ||
441 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 454 | if (DeRezAction.SaveToExistingUserInventoryItem == action) |
442 | { | 455 | { |
@@ -469,9 +482,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
469 | 482 | ||
470 | // This is a hook to do some per-asset post-processing for subclasses that need that | 483 | // This is a hook to do some per-asset post-processing for subclasses that need that |
471 | if (remoteClient != null) | 484 | if (remoteClient != null) |
472 | ExportAsset(remoteClient.AgentId, assetID); | 485 | ExportAsset(remoteClient.AgentId, asset.FullID); |
473 | 486 | ||
474 | return assetID; | 487 | return item; |
475 | } | 488 | } |
476 | 489 | ||
477 | protected virtual void ExportAsset(UUID agentID, UUID assetID) | 490 | protected virtual void ExportAsset(UUID agentID, UUID assetID) |
@@ -617,7 +630,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
617 | if (null == item) | 630 | if (null == item) |
618 | { | 631 | { |
619 | m_log.DebugFormat( | 632 | m_log.DebugFormat( |
620 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | 633 | "[INVENTORY ACCESS MODULE]: Object {0} {1} scheduled for save to inventory has already been deleted.", |
621 | so.Name, so.UUID); | 634 | so.Name, so.UUID); |
622 | 635 | ||
623 | return null; | 636 | return null; |
@@ -668,7 +681,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
668 | { | 681 | { |
669 | // Catch all. Use lost & found | 682 | // Catch all. Use lost & found |
670 | // | 683 | // |
671 | |||
672 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 684 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
673 | } | 685 | } |
674 | } | 686 | } |
@@ -718,7 +730,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
718 | 730 | ||
719 | if (item == null) | 731 | if (item == null) |
720 | { | 732 | { |
721 | |||
722 | return null; | 733 | return null; |
723 | } | 734 | } |
724 | 735 | ||
@@ -748,7 +759,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
748 | else | 759 | else |
749 | { | 760 | { |
750 | m_log.WarnFormat( | 761 | m_log.WarnFormat( |
751 | "[InventoryAccessModule]: Could not find asset {0} for {1} in RezObject()", | 762 | "[INVENTORY ACCESS MODULE]: Could not find asset {0} for {1} in RezObject()", |
752 | assetID, remoteClient.Name); | 763 | assetID, remoteClient.Name); |
753 | } | 764 | } |
754 | 765 | ||
@@ -859,7 +870,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
859 | SceneObjectPart rootPart = group.RootPart; | 870 | SceneObjectPart rootPart = group.RootPart; |
860 | 871 | ||
861 | // m_log.DebugFormat( | 872 | // m_log.DebugFormat( |
862 | // "[InventoryAccessModule]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", | 873 | // "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", |
863 | // group.Name, group.LocalId, group.UUID, | 874 | // group.Name, group.LocalId, group.UUID, |
864 | // group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask, | 875 | // group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask, |
865 | // remoteClient.Name); | 876 | // remoteClient.Name); |
@@ -867,7 +878,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
867 | // Vector3 storedPosition = group.AbsolutePosition; | 878 | // Vector3 storedPosition = group.AbsolutePosition; |
868 | if (group.UUID == UUID.Zero) | 879 | if (group.UUID == UUID.Zero) |
869 | { | 880 | { |
870 | m_log.Debug("[InventoryAccessModule]: Object has UUID.Zero! Position 3"); | 881 | m_log.Debug("[INVENTORY ACCESS MODULE]: Object has UUID.Zero! Position 3"); |
871 | } | 882 | } |
872 | 883 | ||
873 | foreach (SceneObjectPart part in group.Parts) | 884 | foreach (SceneObjectPart part in group.Parts) |
@@ -928,7 +939,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
928 | } | 939 | } |
929 | 940 | ||
930 | // m_log.DebugFormat( | 941 | // m_log.DebugFormat( |
931 | // "[InventoryAccessModule]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", | 942 | // "[INVENTORY ACCESS MODULE]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", |
932 | // group.Name, group.LocalId, group.UUID, | 943 | // group.Name, group.LocalId, group.UUID, |
933 | // group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask, | 944 | // group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask, |
934 | // remoteClient.Name); | 945 | // remoteClient.Name); |
@@ -1023,8 +1034,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1023 | 1034 | ||
1024 | so.FromFolderID = item.Folder; | 1035 | so.FromFolderID = item.Folder; |
1025 | 1036 | ||
1026 | // Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}", | 1037 | // m_log.DebugFormat( |
1027 | // rootPart.OwnerID, item.Owner, item.CurrentPermissions); | 1038 | // "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}", |
1039 | // rootPart.OwnerID, item.Owner, item.CurrentPermissions); | ||
1028 | 1040 | ||
1029 | if ((rootPart.OwnerID != item.Owner) || | 1041 | if ((rootPart.OwnerID != item.Owner) || |
1030 | (item.CurrentPermissions & 16) != 0 || | 1042 | (item.CurrentPermissions & 16) != 0 || |
@@ -1160,7 +1172,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1160 | if (assetRequestItem.AssetID != requestID) | 1172 | if (assetRequestItem.AssetID != requestID) |
1161 | { | 1173 | { |
1162 | m_log.WarnFormat( | 1174 | m_log.WarnFormat( |
1163 | "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}", | 1175 | "[INVENTORY ACCESS MODULE]: {0} requested asset {1} from item {2} but this does not match item's asset {3}", |
1164 | Name, requestID, itemID, assetRequestItem.AssetID); | 1176 | Name, requestID, itemID, assetRequestItem.AssetID); |
1165 | 1177 | ||
1166 | return false; | 1178 | return false; |
diff --git a/OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs b/OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs new file mode 100644 index 0000000..1526886 --- /dev/null +++ b/OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs | |||
@@ -0,0 +1,224 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Framework.Capabilities; | ||
33 | using OpenSim.Framework.Servers.HttpServer; | ||
34 | using OpenSim.Region.Framework.Interfaces; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using log4net; | ||
37 | using Nini.Config; | ||
38 | using Mono.Addins; | ||
39 | |||
40 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
41 | |||
42 | |||
43 | namespace OpenSim.Region.CoreModules.World.LightShare | ||
44 | { | ||
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EnvironmentModule")] | ||
46 | |||
47 | public class EnvironmentModule : INonSharedRegionModule, IEnvironmentModule | ||
48 | { | ||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private Scene m_scene = null; | ||
52 | private UUID regionID = UUID.Zero; | ||
53 | private static bool Enabled = false; | ||
54 | |||
55 | private static readonly string capsName = "EnvironmentSettings"; | ||
56 | private static readonly string capsBase = "/CAPS/0020/"; | ||
57 | |||
58 | private LLSDEnvironmentSetResponse setResponse = null; | ||
59 | |||
60 | #region INonSharedRegionModule | ||
61 | public void Initialise(IConfigSource source) | ||
62 | { | ||
63 | IConfig config = source.Configs["ClientStack.LindenCaps"]; | ||
64 | |||
65 | if (null == config) | ||
66 | return; | ||
67 | |||
68 | if (config.GetString("Cap_EnvironmentSettings", String.Empty) != "localhost") | ||
69 | { | ||
70 | m_log.InfoFormat("[{0}]: Module is disabled.", Name); | ||
71 | return; | ||
72 | } | ||
73 | |||
74 | Enabled = true; | ||
75 | |||
76 | m_log.InfoFormat("[{0}]: Module is enabled.", Name); | ||
77 | } | ||
78 | |||
79 | public void Close() | ||
80 | { | ||
81 | } | ||
82 | |||
83 | public string Name | ||
84 | { | ||
85 | get { return "EnvironmentModule"; } | ||
86 | } | ||
87 | |||
88 | public Type ReplaceableInterface | ||
89 | { | ||
90 | get { return null; } | ||
91 | } | ||
92 | |||
93 | public void AddRegion(Scene scene) | ||
94 | { | ||
95 | if (!Enabled) | ||
96 | return; | ||
97 | |||
98 | scene.RegisterModuleInterface<IEnvironmentModule>(this); | ||
99 | m_scene = scene; | ||
100 | regionID = scene.RegionInfo.RegionID; | ||
101 | } | ||
102 | |||
103 | public void RegionLoaded(Scene scene) | ||
104 | { | ||
105 | if (!Enabled) | ||
106 | return; | ||
107 | |||
108 | setResponse = new LLSDEnvironmentSetResponse(); | ||
109 | scene.EventManager.OnRegisterCaps += OnRegisterCaps; | ||
110 | } | ||
111 | |||
112 | public void RemoveRegion(Scene scene) | ||
113 | { | ||
114 | if (Enabled) | ||
115 | return; | ||
116 | |||
117 | scene.EventManager.OnRegisterCaps -= OnRegisterCaps; | ||
118 | m_scene = null; | ||
119 | } | ||
120 | #endregion | ||
121 | |||
122 | #region IEnvironmentModule | ||
123 | public void ResetEnvironmentSettings(UUID regionUUID) | ||
124 | { | ||
125 | if (!Enabled) | ||
126 | return; | ||
127 | |||
128 | m_scene.SimulationDataService.RemoveRegionEnvironmentSettings(regionUUID); | ||
129 | } | ||
130 | #endregion | ||
131 | |||
132 | #region Events | ||
133 | private void OnRegisterCaps(UUID agentID, Caps caps) | ||
134 | { | ||
135 | // m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}", | ||
136 | // Name, agentID, caps.RegionName); | ||
137 | |||
138 | string capsPath = capsBase + UUID.Random(); | ||
139 | |||
140 | // Get handler | ||
141 | caps.RegisterHandler( | ||
142 | capsName, | ||
143 | new RestStreamHandler( | ||
144 | "GET", | ||
145 | capsPath, | ||
146 | (request, path, param, httpRequest, httpResponse) | ||
147 | => GetEnvironmentSettings(request, path, param, agentID, caps), | ||
148 | capsName, | ||
149 | agentID.ToString())); | ||
150 | |||
151 | // Set handler | ||
152 | caps.HttpListener.AddStreamHandler( | ||
153 | new RestStreamHandler( | ||
154 | "POST", | ||
155 | capsPath, | ||
156 | (request, path, param, httpRequest, httpResponse) | ||
157 | => SetEnvironmentSettings(request, path, param, agentID, caps), | ||
158 | capsName, | ||
159 | agentID.ToString())); | ||
160 | } | ||
161 | #endregion | ||
162 | |||
163 | private string GetEnvironmentSettings(string request, string path, string param, | ||
164 | UUID agentID, Caps caps) | ||
165 | { | ||
166 | // m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}", | ||
167 | // Name, agentID, caps.RegionName); | ||
168 | |||
169 | string env = String.Empty; | ||
170 | |||
171 | try | ||
172 | { | ||
173 | env = m_scene.SimulationDataService.LoadRegionEnvironmentSettings(regionID); | ||
174 | } | ||
175 | catch (Exception e) | ||
176 | { | ||
177 | m_log.ErrorFormat("[{0}]: Unable to load environment settings for region {1}, Exception: {2} - {3}", | ||
178 | Name, caps.RegionName, e.Message, e.StackTrace); | ||
179 | } | ||
180 | |||
181 | if (String.IsNullOrEmpty(env)) | ||
182 | env = EnvironmentSettings.EmptySettings(UUID.Zero, regionID); | ||
183 | |||
184 | return env; | ||
185 | } | ||
186 | |||
187 | private string SetEnvironmentSettings(string request, string path, string param, | ||
188 | UUID agentID, Caps caps) | ||
189 | { | ||
190 | |||
191 | // m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}", | ||
192 | // Name, agentID, caps.RegionName); | ||
193 | |||
194 | setResponse.regionID = regionID; | ||
195 | setResponse.success = false; | ||
196 | |||
197 | if (!m_scene.Permissions.CanIssueEstateCommand(agentID, false)) | ||
198 | { | ||
199 | setResponse.fail_reason = "Insufficient estate permissions, settings has not been saved."; | ||
200 | return LLSDHelpers.SerialiseLLSDReply(setResponse); | ||
201 | } | ||
202 | |||
203 | try | ||
204 | { | ||
205 | m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, request); | ||
206 | setResponse.success = true; | ||
207 | |||
208 | m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}", | ||
209 | Name, agentID, caps.RegionName); | ||
210 | } | ||
211 | catch (Exception e) | ||
212 | { | ||
213 | m_log.ErrorFormat("[{0}]: Environment settings has not been saved for region {1}, Exception: {2} - {3}", | ||
214 | Name, caps.RegionName, e.Message, e.StackTrace); | ||
215 | |||
216 | setResponse.success = false; | ||
217 | setResponse.fail_reason = String.Format("Environment Set for region {0} has failed, settings has not been saved.", caps.RegionName); | ||
218 | } | ||
219 | |||
220 | return LLSDHelpers.SerialiseLLSDReply(setResponse); | ||
221 | } | ||
222 | } | ||
223 | } | ||
224 | |||
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 199dd11..1865ab8 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -85,6 +85,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
85 | private IHttpServer m_HttpsServer = null; | 85 | private IHttpServer m_HttpsServer = null; |
86 | 86 | ||
87 | private string m_ExternalHostNameForLSL = ""; | 87 | private string m_ExternalHostNameForLSL = ""; |
88 | public string ExternalHostNameForLSL | ||
89 | { | ||
90 | get { return m_ExternalHostNameForLSL; } | ||
91 | } | ||
88 | 92 | ||
89 | public Type ReplaceableInterface | 93 | public Type ReplaceableInterface |
90 | { | 94 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index 8df1c7b..a7dd0dd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs | |||
@@ -122,7 +122,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid | |||
122 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); | 122 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); |
123 | IFriendsSimConnector friendsConn = scene.RequestModuleInterface<IFriendsSimConnector>(); | 123 | IFriendsSimConnector friendsConn = scene.RequestModuleInterface<IFriendsSimConnector>(); |
124 | Object[] args = new Object[] { m_Config }; | 124 | Object[] args = new Object[] { m_Config }; |
125 | IFriendsService friendsService = ServerUtils.LoadPlugin<IFriendsService>(m_LocalServiceDll, args); | 125 | // IFriendsService friendsService = ServerUtils.LoadPlugin<IFriendsService>(m_LocalServiceDll, args) |
126 | ServerUtils.LoadPlugin<IFriendsService>(m_LocalServiceDll, args); | ||
126 | 127 | ||
127 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); | 128 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); |
128 | 129 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index 8395f83..008465f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |||
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
149 | 149 | ||
150 | m_aScene = scene; | 150 | m_aScene = scene; |
151 | 151 | ||
152 | scene.RegisterModuleInterface<IAssetService>(this); | 152 | m_aScene.RegisterModuleInterface<IAssetService>(this); |
153 | } | 153 | } |
154 | 154 | ||
155 | public void RemoveRegion(Scene scene) | 155 | public void RemoveRegion(Scene scene) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index de089f3..008992e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | using System; | 27 | using System; |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Linq; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using log4net; | 31 | using log4net; |
31 | using Nini.Config; | 32 | using Nini.Config; |
@@ -41,22 +42,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
41 | public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService | 42 | public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService |
42 | { | 43 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | // Version of this service | ||
45 | private const string m_Version = "SIMULATION/0.1"; | ||
46 | 45 | ||
47 | private List<Scene> m_sceneList = new List<Scene>(); | 46 | /// <summary> |
47 | /// Version of this service | ||
48 | /// </summary> | ||
49 | private const string m_Version = "SIMULATION/0.1"; | ||
48 | 50 | ||
49 | private IEntityTransferModule m_AgentTransferModule; | 51 | /// <summary> |
50 | protected IEntityTransferModule AgentTransferModule | 52 | /// Map region ID to scene. |
51 | { | 53 | /// </summary> |
52 | get | 54 | private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); |
53 | { | ||
54 | if (m_AgentTransferModule == null) | ||
55 | m_AgentTransferModule = m_sceneList[0].RequestModuleInterface<IEntityTransferModule>(); | ||
56 | return m_AgentTransferModule; | ||
57 | } | ||
58 | } | ||
59 | 55 | ||
56 | /// <summary> | ||
57 | /// Is this module enabled? | ||
58 | /// </summary> | ||
60 | private bool m_ModuleEnabled = false; | 59 | private bool m_ModuleEnabled = false; |
61 | 60 | ||
62 | #region IRegionModule | 61 | #region IRegionModule |
@@ -129,12 +128,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
129 | /// <param name="scene"></param> | 128 | /// <param name="scene"></param> |
130 | public void RemoveScene(Scene scene) | 129 | public void RemoveScene(Scene scene) |
131 | { | 130 | { |
132 | lock (m_sceneList) | 131 | lock (m_scenes) |
133 | { | 132 | { |
134 | if (m_sceneList.Contains(scene)) | 133 | if (m_scenes.ContainsKey(scene.RegionInfo.RegionID)) |
135 | { | 134 | m_scenes.Remove(scene.RegionInfo.RegionID); |
136 | m_sceneList.Remove(scene); | 135 | else |
137 | } | 136 | m_log.WarnFormat( |
137 | "[LOCAL SIMULATION CONNECTOR]: Tried to remove region {0} but it was not present", | ||
138 | scene.RegionInfo.RegionName); | ||
138 | } | 139 | } |
139 | } | 140 | } |
140 | 141 | ||
@@ -144,13 +145,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
144 | /// <param name="scene"></param> | 145 | /// <param name="scene"></param> |
145 | public void Init(Scene scene) | 146 | public void Init(Scene scene) |
146 | { | 147 | { |
147 | if (!m_sceneList.Contains(scene)) | 148 | lock (m_scenes) |
148 | { | 149 | { |
149 | lock (m_sceneList) | 150 | if (!m_scenes.ContainsKey(scene.RegionInfo.RegionID)) |
150 | { | 151 | m_scenes[scene.RegionInfo.RegionID] = scene; |
151 | m_sceneList.Add(scene); | 152 | else |
152 | } | 153 | m_log.WarnFormat( |
153 | 154 | "[LOCAL SIMULATION CONNECTOR]: Tried to add region {0} but it is already present", | |
155 | scene.RegionInfo.RegionName); | ||
154 | } | 156 | } |
155 | } | 157 | } |
156 | 158 | ||
@@ -158,15 +160,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
158 | 160 | ||
159 | #region ISimulation | 161 | #region ISimulation |
160 | 162 | ||
161 | public IScene GetScene(ulong regionhandle) | 163 | public IScene GetScene(UUID regionId) |
162 | { | 164 | { |
163 | foreach (Scene s in m_sceneList) | 165 | if (m_scenes.ContainsKey(regionId)) |
164 | { | 166 | { |
165 | if (s.RegionInfo.RegionHandle == regionhandle) | 167 | return m_scenes[regionId]; |
166 | return s; | 168 | } |
169 | else | ||
170 | { | ||
171 | // FIXME: This was pre-existing behaviour but possibly not a good idea, since it hides an error rather | ||
172 | // than making it obvious and fixable. Need to see if the error message comes up in practice. | ||
173 | Scene s = m_scenes.Values.ToArray()[0]; | ||
174 | |||
175 | m_log.ErrorFormat( | ||
176 | "[LOCAL SIMULATION CONNECTOR]: Region with id {0} not found. Returning {1} {2} instead", | ||
177 | regionId, s.RegionInfo.RegionName, s.RegionInfo.RegionID); | ||
178 | |||
179 | return s; | ||
167 | } | 180 | } |
168 | // ? weird. should not happen | ||
169 | return m_sceneList[0]; | ||
170 | } | 181 | } |
171 | 182 | ||
172 | public ISimulationService GetInnerService() | 183 | public ISimulationService GetInnerService() |
@@ -187,13 +198,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
187 | return false; | 198 | return false; |
188 | } | 199 | } |
189 | 200 | ||
190 | foreach (Scene s in m_sceneList) | 201 | if (m_scenes.ContainsKey(destination.RegionID)) |
191 | { | 202 | { |
192 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | ||
193 | { | ||
194 | // m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName); | 203 | // m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName); |
195 | return s.NewUserConnection(aCircuit, teleportFlags, out reason); | 204 | return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, out reason); |
196 | } | ||
197 | } | 205 | } |
198 | 206 | ||
199 | reason = "Did not find region " + destination.RegionName; | 207 | reason = "Did not find region " + destination.RegionName; |
@@ -205,17 +213,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
205 | if (destination == null) | 213 | if (destination == null) |
206 | return false; | 214 | return false; |
207 | 215 | ||
208 | foreach (Scene s in m_sceneList) | 216 | if (m_scenes.ContainsKey(destination.RegionID)) |
209 | { | 217 | { |
210 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | ||
211 | { | ||
212 | // m_log.DebugFormat( | 218 | // m_log.DebugFormat( |
213 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", | 219 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
214 | // s.RegionInfo.RegionName, destination.RegionHandle); | 220 | // s.RegionInfo.RegionName, destination.RegionHandle); |
215 | 221 | ||
216 | s.IncomingChildAgentDataUpdate(cAgentData); | 222 | return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData); |
217 | return true; | ||
218 | } | ||
219 | } | 223 | } |
220 | 224 | ||
221 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); | 225 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); |
@@ -231,11 +235,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
231 | // simulator so when we receive the update we need to hand it to each of the | 235 | // simulator so when we receive the update we need to hand it to each of the |
232 | // scenes; scenes each check to see if the is a scene presence for the avatar | 236 | // scenes; scenes each check to see if the is a scene presence for the avatar |
233 | // note that we really don't need the GridRegion for this call | 237 | // note that we really don't need the GridRegion for this call |
234 | foreach (Scene s in m_sceneList) | 238 | foreach (Scene s in m_scenes.Values) |
235 | { | 239 | { |
236 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); | 240 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); |
237 | s.IncomingChildAgentDataUpdate(cAgentData); | 241 | s.IncomingChildAgentDataUpdate(cAgentData); |
238 | } | 242 | } |
243 | |||
239 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); | 244 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); |
240 | return true; | 245 | return true; |
241 | } | 246 | } |
@@ -247,14 +252,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
247 | if (destination == null) | 252 | if (destination == null) |
248 | return false; | 253 | return false; |
249 | 254 | ||
250 | foreach (Scene s in m_sceneList) | 255 | if (m_scenes.ContainsKey(destination.RegionID)) |
251 | { | 256 | { |
252 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | 257 | // m_log.DebugFormat( |
253 | { | 258 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
254 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); | 259 | // s.RegionInfo.RegionName, destination.RegionHandle); |
255 | return s.IncomingRetrieveRootAgent(id, out agent); | 260 | |
256 | } | 261 | return m_scenes[destination.RegionID].IncomingRetrieveRootAgent(id, out agent); |
257 | } | 262 | } |
263 | |||
258 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); | 264 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); |
259 | return false; | 265 | return false; |
260 | } | 266 | } |
@@ -266,59 +272,49 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
266 | if (destination == null) | 272 | if (destination == null) |
267 | return false; | 273 | return false; |
268 | 274 | ||
269 | foreach (Scene s in m_sceneList) | 275 | if (m_scenes.ContainsKey(destination.RegionID)) |
270 | { | 276 | { |
271 | if (s.RegionInfo.RegionID == destination.RegionID) | 277 | // m_log.DebugFormat( |
272 | return s.QueryAccess(id, position, out reason); | 278 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
279 | // s.RegionInfo.RegionName, destination.RegionHandle); | ||
280 | |||
281 | return m_scenes[destination.RegionID].QueryAccess(id, position, out reason); | ||
273 | } | 282 | } |
283 | |||
284 | //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); | ||
274 | return false; | 285 | return false; |
275 | } | 286 | } |
276 | 287 | ||
277 | public bool ReleaseAgent(UUID origin, UUID id, string uri) | 288 | public bool ReleaseAgent(UUID originId, UUID agentId, string uri) |
278 | { | 289 | { |
279 | foreach (Scene s in m_sceneList) | 290 | if (m_scenes.ContainsKey(originId)) |
280 | { | 291 | { |
281 | if (s.RegionInfo.RegionID == origin) | 292 | // m_log.DebugFormat( |
282 | { | 293 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
283 | // m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent"); | 294 | // s.RegionInfo.RegionName, destination.RegionHandle); |
284 | AgentTransferModule.AgentArrivedAtDestination(id); | 295 | |
285 | return true; | 296 | m_scenes[originId].EntityTransferModule.AgentArrivedAtDestination(agentId); |
286 | // return s.IncomingReleaseAgent(id); | 297 | return true; |
287 | } | ||
288 | } | 298 | } |
299 | |||
289 | //m_log.Debug("[LOCAL COMMS]: region not found in SendReleaseAgent " + origin); | 300 | //m_log.Debug("[LOCAL COMMS]: region not found in SendReleaseAgent " + origin); |
290 | return false; | 301 | return false; |
291 | } | 302 | } |
292 | 303 | ||
293 | public bool CloseAgent(GridRegion destination, UUID id) | 304 | public bool CloseChildAgent(GridRegion destination, UUID id) |
294 | { | 305 | { |
295 | if (destination == null) | 306 | return CloseAgent(destination, id); |
296 | return false; | ||
297 | |||
298 | foreach (Scene s in m_sceneList) | ||
299 | { | ||
300 | if (s.RegionInfo.RegionID == destination.RegionID) | ||
301 | { | ||
302 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | ||
303 | return s.IncomingCloseAgent(id); | ||
304 | } | ||
305 | } | ||
306 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); | ||
307 | return false; | ||
308 | } | 307 | } |
309 | 308 | ||
310 | public bool CloseChildAgent(GridRegion destination, UUID id) | 309 | public bool CloseAgent(GridRegion destination, UUID id) |
311 | { | 310 | { |
312 | if (destination == null) | 311 | if (destination == null) |
313 | return false; | 312 | return false; |
314 | 313 | ||
315 | foreach (Scene s in m_sceneList) | 314 | if (m_scenes.ContainsKey(destination.RegionID)) |
316 | { | 315 | { |
317 | if (s.RegionInfo.RegionID == destination.RegionID) | 316 | Util.FireAndForget(delegate { m_scenes[destination.RegionID].IncomingCloseAgent(id); }); |
318 | { | 317 | return true; |
319 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | ||
320 | return s.IncomingCloseChildAgent(id); | ||
321 | } | ||
322 | } | 318 | } |
323 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); | 319 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); |
324 | return false; | 320 | return false; |
@@ -333,25 +329,28 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
333 | if (destination == null) | 329 | if (destination == null) |
334 | return false; | 330 | return false; |
335 | 331 | ||
336 | foreach (Scene s in m_sceneList) | 332 | if (m_scenes.ContainsKey(destination.RegionID)) |
337 | { | 333 | { |
338 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | 334 | // m_log.DebugFormat( |
335 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", | ||
336 | // s.RegionInfo.RegionName, destination.RegionHandle); | ||
337 | |||
338 | Scene s = m_scenes[destination.RegionID]; | ||
339 | |||
340 | if (isLocalCall) | ||
339 | { | 341 | { |
340 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); | 342 | // We need to make a local copy of the object |
341 | if (isLocalCall) | 343 | ISceneObject sogClone = sog.CloneForNewScene(); |
342 | { | 344 | sogClone.SetState(sog.GetStateSnapshot(), s); |
343 | // We need to make a local copy of the object | 345 | return s.IncomingCreateObject(newPosition, sogClone); |
344 | ISceneObject sogClone = sog.CloneForNewScene(); | 346 | } |
345 | sogClone.SetState(sog.GetStateSnapshot(), s); | 347 | else |
346 | return s.IncomingCreateObject(newPosition, sogClone); | 348 | { |
347 | } | 349 | // Use the object as it came through the wire |
348 | else | 350 | return s.IncomingCreateObject(newPosition, sog); |
349 | { | ||
350 | // Use the object as it came through the wire | ||
351 | return s.IncomingCreateObject(newPosition, sog); | ||
352 | } | ||
353 | } | 351 | } |
354 | } | 352 | } |
353 | |||
355 | return false; | 354 | return false; |
356 | } | 355 | } |
357 | 356 | ||
@@ -360,13 +359,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
360 | if (destination == null) | 359 | if (destination == null) |
361 | return false; | 360 | return false; |
362 | 361 | ||
363 | foreach (Scene s in m_sceneList) | 362 | if (m_scenes.ContainsKey(destination.RegionID)) |
364 | { | 363 | { |
365 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | 364 | // m_log.DebugFormat( |
366 | { | 365 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
367 | return s.IncomingCreateObject(userID, itemID); | 366 | // s.RegionInfo.RegionName, destination.RegionHandle); |
368 | } | 367 | |
368 | return m_scenes[destination.RegionID].IncomingCreateObject(userID, itemID); | ||
369 | } | 369 | } |
370 | |||
370 | return false; | 371 | return false; |
371 | } | 372 | } |
372 | 373 | ||
@@ -377,18 +378,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
377 | 378 | ||
378 | public bool IsLocalRegion(ulong regionhandle) | 379 | public bool IsLocalRegion(ulong regionhandle) |
379 | { | 380 | { |
380 | foreach (Scene s in m_sceneList) | 381 | foreach (Scene s in m_scenes.Values) |
381 | if (s.RegionInfo.RegionHandle == regionhandle) | 382 | if (s.RegionInfo.RegionHandle == regionhandle) |
382 | return true; | 383 | return true; |
384 | |||
383 | return false; | 385 | return false; |
384 | } | 386 | } |
385 | 387 | ||
386 | public bool IsLocalRegion(UUID id) | 388 | public bool IsLocalRegion(UUID id) |
387 | { | 389 | { |
388 | foreach (Scene s in m_sceneList) | 390 | return m_scenes.ContainsKey(id); |
389 | if (s.RegionInfo.RegionID == id) | ||
390 | return true; | ||
391 | return false; | ||
392 | } | 391 | } |
393 | 392 | ||
394 | #endregion | 393 | #endregion |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 4b70692..d395413 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -151,9 +151,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
151 | 151 | ||
152 | #region IInterregionComms | 152 | #region IInterregionComms |
153 | 153 | ||
154 | public IScene GetScene(ulong handle) | 154 | public IScene GetScene(UUID regionId) |
155 | { | 155 | { |
156 | return m_localBackend.GetScene(handle); | 156 | return m_localBackend.GetScene(regionId); |
157 | } | 157 | } |
158 | 158 | ||
159 | public ISimulationService GetInnerService() | 159 | public ISimulationService GetInnerService() |
@@ -226,13 +226,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
226 | return m_remoteConnector.RetrieveAgent(destination, id, out agent); | 226 | return m_remoteConnector.RetrieveAgent(destination, id, out agent); |
227 | 227 | ||
228 | return false; | 228 | return false; |
229 | |||
230 | } | 229 | } |
231 | 230 | ||
232 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) | 231 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) |
233 | { | 232 | { |
234 | reason = "Communications failure"; | 233 | reason = "Communications failure"; |
235 | version = "Unknown"; | 234 | version = "Unknown"; |
235 | |||
236 | if (destination == null) | 236 | if (destination == null) |
237 | return false; | 237 | return false; |
238 | 238 | ||
@@ -245,7 +245,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
245 | return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason); | 245 | return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason); |
246 | 246 | ||
247 | return false; | 247 | return false; |
248 | |||
249 | } | 248 | } |
250 | 249 | ||
251 | public bool ReleaseAgent(UUID origin, UUID id, string uri) | 250 | public bool ReleaseAgent(UUID origin, UUID id, string uri) |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 504f09b..4edaaca 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -428,9 +428,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
428 | s = sw.ToString(); | 428 | s = sw.ToString(); |
429 | } | 429 | } |
430 | 430 | ||
431 | if (m_scene != null) | 431 | // if (m_scene != null) |
432 | Console.WriteLine( | 432 | // Console.WriteLine( |
433 | "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s); | 433 | // "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s); |
434 | 434 | ||
435 | return s; | 435 | return s; |
436 | } | 436 | } |
diff --git a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs new file mode 100644 index 0000000..2838e0c --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs | |||
@@ -0,0 +1,155 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using System.Text.RegularExpressions; | ||
33 | using log4net; | ||
34 | using Mono.Addins; | ||
35 | using NDesk.Options; | ||
36 | using Nini.Config; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Console; | ||
40 | using OpenSim.Framework.Statistics; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | |||
44 | namespace OpenSim.Region.CoreModules.World.Objects.Commands | ||
45 | { | ||
46 | /// <summary> | ||
47 | /// A module that holds commands for manipulating objects in the scene. | ||
48 | /// </summary> | ||
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RegionCommandsModule")] | ||
50 | public class RegionCommandsModule : INonSharedRegionModule | ||
51 | { | ||
52 | private Scene m_scene; | ||
53 | private ICommandConsole m_console; | ||
54 | |||
55 | public string Name { get { return "Region Commands Module"; } } | ||
56 | |||
57 | public Type ReplaceableInterface { get { return null; } } | ||
58 | |||
59 | public void Initialise(IConfigSource source) | ||
60 | { | ||
61 | // m_log.DebugFormat("[REGION COMMANDS MODULE]: INITIALIZED MODULE"); | ||
62 | } | ||
63 | |||
64 | public void PostInitialise() | ||
65 | { | ||
66 | // m_log.DebugFormat("[REGION COMMANDS MODULE]: POST INITIALIZED MODULE"); | ||
67 | } | ||
68 | |||
69 | public void Close() | ||
70 | { | ||
71 | // m_log.DebugFormat("[REGION COMMANDS MODULE]: CLOSED MODULE"); | ||
72 | } | ||
73 | |||
74 | public void AddRegion(Scene scene) | ||
75 | { | ||
76 | // m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | ||
77 | |||
78 | m_scene = scene; | ||
79 | m_console = MainConsole.Instance; | ||
80 | |||
81 | m_console.Commands.AddCommand( | ||
82 | "Regions", false, "show scene", | ||
83 | "show scene", | ||
84 | "Show live scene information for the currently selected region.", HandleShowScene); | ||
85 | } | ||
86 | |||
87 | public void RemoveRegion(Scene scene) | ||
88 | { | ||
89 | // m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); | ||
90 | } | ||
91 | |||
92 | public void RegionLoaded(Scene scene) | ||
93 | { | ||
94 | // m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | ||
95 | } | ||
96 | |||
97 | private void HandleShowScene(string module, string[] cmd) | ||
98 | { | ||
99 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) | ||
100 | return; | ||
101 | |||
102 | SimStatsReporter r = m_scene.StatsReporter; | ||
103 | float[] stats = r.LastReportedSimStats; | ||
104 | |||
105 | float timeDilation = stats[0]; | ||
106 | float simFps = stats[1]; | ||
107 | float physicsFps = stats[2]; | ||
108 | float agentUpdates = stats[3]; | ||
109 | float rootAgents = stats[4]; | ||
110 | float childAgents = stats[5]; | ||
111 | float totalPrims = stats[6]; | ||
112 | float activePrims = stats[7]; | ||
113 | float totalFrameTime = stats[8]; | ||
114 | // float netFrameTime = stats.StatsBlock[9].StatValue; // Ignored - not used by OpenSimulator | ||
115 | float physicsFrameTime = stats[10]; | ||
116 | float otherFrameTime = stats[11]; | ||
117 | // float imageFrameTime = stats.StatsBlock[12].StatValue; // Ignored | ||
118 | float inPacketsPerSecond = stats[13]; | ||
119 | float outPacketsPerSecond = stats[14]; | ||
120 | float unackedBytes = stats[15]; | ||
121 | // float agentFrameTime = stats.StatsBlock[16].StatValue; // Not really used | ||
122 | float pendingDownloads = stats[17]; | ||
123 | float pendingUploads = stats[18]; | ||
124 | float activeScripts = stats[19]; | ||
125 | float scriptLinesPerSecond = stats[20]; | ||
126 | |||
127 | StringBuilder sb = new StringBuilder(); | ||
128 | sb.AppendFormat("Scene statistics for {0}\n", m_scene.RegionInfo.RegionName); | ||
129 | |||
130 | ConsoleDisplayList dispList = new ConsoleDisplayList(); | ||
131 | dispList.AddRow("Time Dilation", timeDilation); | ||
132 | dispList.AddRow("Sim FPS", simFps); | ||
133 | dispList.AddRow("Physics FPS", physicsFps); | ||
134 | dispList.AddRow("Avatars", rootAgents); | ||
135 | dispList.AddRow("Child agents", childAgents); | ||
136 | dispList.AddRow("Total prims", totalPrims); | ||
137 | dispList.AddRow("Scripts", activeScripts); | ||
138 | dispList.AddRow("Script lines processed per second", scriptLinesPerSecond); | ||
139 | dispList.AddRow("Physics enabled prims", activePrims); | ||
140 | dispList.AddRow("Total frame time", totalFrameTime); | ||
141 | dispList.AddRow("Physics frame time", physicsFrameTime); | ||
142 | dispList.AddRow("Other frame time", otherFrameTime); | ||
143 | dispList.AddRow("Agent Updates per second", agentUpdates); | ||
144 | dispList.AddRow("Packets processed from clients per second", inPacketsPerSecond); | ||
145 | dispList.AddRow("Packets sent to clients per second", outPacketsPerSecond); | ||
146 | dispList.AddRow("Bytes unacknowledged by clients", unackedBytes); | ||
147 | dispList.AddRow("Pending asset downloads to clients", pendingDownloads); | ||
148 | dispList.AddRow("Pending asset uploads from clients", pendingUploads); | ||
149 | |||
150 | dispList.AddToStringBuilder(sb); | ||
151 | |||
152 | MainConsole.Instance.Output(sb.ToString()); | ||
153 | } | ||
154 | } | ||
155 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs index 5d2f893..b416b82 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
59 | } | 59 | } |
60 | 60 | ||
61 | //Returns true if this extension is supported for terrain save-tile | 61 | //Returns true if this extension is supported for terrain save-tile |
62 | public bool SupportsTileSave() | 62 | public override bool SupportsTileSave() |
63 | { | 63 | { |
64 | return false; | 64 | return false; |
65 | } | 65 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs index 1ebf916..71c71e6 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs | |||
@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
65 | bool eof = false; | 65 | bool eof = false; |
66 | 66 | ||
67 | int fileXPoints = 0; | 67 | int fileXPoints = 0; |
68 | int fileYPoints = 0; | 68 | // int fileYPoints = 0; |
69 | 69 | ||
70 | // Terragen file | 70 | // Terragen file |
71 | while (eof == false) | 71 | while (eof == false) |
@@ -75,7 +75,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
75 | { | 75 | { |
76 | case "SIZE": | 76 | case "SIZE": |
77 | fileXPoints = bs.ReadInt16() + 1; | 77 | fileXPoints = bs.ReadInt16() + 1; |
78 | fileYPoints = fileXPoints; | 78 | // fileYPoints = fileXPoints; |
79 | bs.ReadInt16(); | 79 | bs.ReadInt16(); |
80 | break; | 80 | break; |
81 | case "XPTS": | 81 | case "XPTS": |
@@ -83,7 +83,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
83 | bs.ReadInt16(); | 83 | bs.ReadInt16(); |
84 | break; | 84 | break; |
85 | case "YPTS": | 85 | case "YPTS": |
86 | fileYPoints = bs.ReadInt16(); | 86 | // fileYPoints = bs.ReadInt16(); |
87 | bs.ReadInt16(); | ||
87 | bs.ReadInt16(); | 88 | bs.ReadInt16(); |
88 | break; | 89 | break; |
89 | case "ALTW": | 90 | case "ALTW": |
@@ -164,10 +165,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
164 | bool eof = false; | 165 | bool eof = false; |
165 | if (Encoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ") | 166 | if (Encoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ") |
166 | { | 167 | { |
167 | 168 | // int fileWidth = w; | |
168 | int fileWidth = w; | 169 | // int fileHeight = h; |
169 | int fileHeight = h; | ||
170 | |||
171 | 170 | ||
172 | // Terragen file | 171 | // Terragen file |
173 | while (eof == false) | 172 | while (eof == false) |
@@ -176,17 +175,22 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
176 | switch (tmp) | 175 | switch (tmp) |
177 | { | 176 | { |
178 | case "SIZE": | 177 | case "SIZE": |
179 | int sztmp = bs.ReadInt16() + 1; | 178 | // int sztmp = bs.ReadInt16() + 1; |
180 | fileWidth = sztmp; | 179 | // fileWidth = sztmp; |
181 | fileHeight = sztmp; | 180 | // fileHeight = sztmp; |
181 | bs.ReadInt16(); | ||
182 | bs.ReadInt16(); | ||
183 | bs.ReadInt16(); | ||
182 | bs.ReadInt16(); | 184 | bs.ReadInt16(); |
183 | break; | 185 | break; |
184 | case "XPTS": | 186 | case "XPTS": |
185 | fileWidth = bs.ReadInt16(); | 187 | // fileWidth = bs.ReadInt16(); |
188 | bs.ReadInt16(); | ||
186 | bs.ReadInt16(); | 189 | bs.ReadInt16(); |
187 | break; | 190 | break; |
188 | case "YPTS": | 191 | case "YPTS": |
189 | fileHeight = bs.ReadInt16(); | 192 | // fileHeight = bs.ReadInt16(); |
193 | bs.ReadInt16(); | ||
190 | bs.ReadInt16(); | 194 | bs.ReadInt16(); |
191 | break; | 195 | break; |
192 | case "ALTW": | 196 | case "ALTW": |