aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs306
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs109
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs82
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs (renamed from OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs)10
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs87
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs65
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs5
-rw-r--r--OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs237
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs5
13 files changed, 739 insertions, 185 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 612c0d9..6a76069 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3589,129 +3589,142 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3589 OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); 3589 OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
3590 OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); 3590 OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
3591 OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); 3591 OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
3592 OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
3592 3593
3593 if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; 3594 if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
3594 int updatesThisCall = 0; 3595 int updatesThisCall = 0;
3595 3596
3596 lock (m_entityUpdates.SyncRoot) 3597 EntityUpdate update;
3598 while (updatesThisCall < maxUpdates)
3597 { 3599 {
3598 EntityUpdate update; 3600 lock (m_entityUpdates.SyncRoot)
3599 while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update)) 3601 if (!m_entityUpdates.TryDequeue(out update))
3600 { 3602 break;
3601 if (update.Entity is SceneObjectPart)
3602 {
3603 SceneObjectPart part = (SceneObjectPart)update.Entity;
3604 if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId))
3605 continue;
3606 3603
3607 if (m_killRecord.Contains(part.LocalId)) 3604 if (update.Entity is SceneObjectPart)
3605 {
3606 SceneObjectPart part = (SceneObjectPart)update.Entity;
3607
3608 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
3609 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good
3610 // safety measure.
3611 //
3612 // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
3613 // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
3614 // updates and kills on different threads with different scheduling strategies, hence this protection.
3615 //
3616 // This doesn't appear to apply to child prims - a client will happily ignore these updates
3617 // after the root prim has been deleted.
3618 if (m_killRecord.Contains(part.LocalId))
3619 continue;
3620 if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId))
3621 continue;
3622
3623 if (part.ParentGroup.IsDeleted)
3624 continue;
3625
3626 if (part.ParentGroup.IsAttachment)
3627 { // Someone else's HUD, why are we getting these?
3628 if (part.ParentGroup.OwnerID != AgentId &&
3629 part.ParentGroup.RootPart.Shape.State >= 30)
3608 continue; 3630 continue;
3609 3631 ScenePresence sp;
3610 if (part.ParentGroup.IsDeleted) 3632 // Owner is not in the sim, don't update it to
3633 // anyone
3634 if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
3611 continue; 3635 continue;
3612 3636
3613 if (part.ParentGroup.IsAttachment) 3637 List<SceneObjectGroup> atts = sp.Attachments;
3614 { // Someone else's HUD, why are we getting these? 3638 bool found = false;
3615 if (part.ParentGroup.OwnerID != AgentId && 3639 foreach (SceneObjectGroup att in atts)
3616 part.ParentGroup.RootPart.Shape.State >= 30) 3640 {
3617 continue; 3641 if (att == part.ParentGroup)
3618 ScenePresence sp;
3619 // Owner is not in the sim, don't update it to
3620 // anyone
3621 if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
3622 continue;
3623
3624 List<SceneObjectGroup> atts = sp.Attachments;
3625 bool found = false;
3626 foreach (SceneObjectGroup att in atts)
3627 { 3642 {
3628 if (att == part.ParentGroup) 3643 found = true;
3629 { 3644 break;
3630 found = true;
3631 break;
3632 }
3633 } 3645 }
3634
3635 // It's an attachment of a valid avatar, but
3636 // doesn't seem to be attached, skip
3637 if (!found)
3638 continue;
3639 } 3646 }
3640 3647
3641 if (part.ParentGroup.IsAttachment && m_disableFacelights) 3648 // It's an attachment of a valid avatar, but
3649 // doesn't seem to be attached, skip
3650 if (!found)
3651 continue;
3652 }
3653
3654 if (part.ParentGroup.IsAttachment && m_disableFacelights)
3655 {
3656 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
3657 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
3642 { 3658 {
3643 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && 3659 part.Shape.LightEntry = false;
3644 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
3645 {
3646 part.Shape.LightEntry = false;
3647 }
3648 } 3660 }
3649 } 3661 }
3662 }
3650 3663
3651 ++updatesThisCall; 3664 ++updatesThisCall;
3652 3665
3653 #region UpdateFlags to packet type conversion 3666 #region UpdateFlags to packet type conversion
3654 3667
3655 PrimUpdateFlags updateFlags = update.Flags; 3668 PrimUpdateFlags updateFlags = update.Flags;
3656 3669
3657 bool canUseCompressed = true; 3670 bool canUseCompressed = true;
3658 bool canUseImproved = true; 3671 bool canUseImproved = true;
3659 3672
3660 // Compressed object updates only make sense for LL primitives 3673 // Compressed object updates only make sense for LL primitives
3661 if (!(update.Entity is SceneObjectPart)) 3674 if (!(update.Entity is SceneObjectPart))
3675 {
3676 canUseCompressed = false;
3677 }
3678
3679 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
3680 {
3681 canUseCompressed = false;
3682 canUseImproved = false;
3683 }
3684 else
3685 {
3686 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
3687 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
3688 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
3689 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3662 { 3690 {
3663 canUseCompressed = false; 3691 canUseCompressed = false;
3664 } 3692 }
3665 3693
3666 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) 3694 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
3695 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
3696 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
3697 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
3698 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
3699 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
3700 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
3701 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
3702 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
3703 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
3704 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
3705 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
3706 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
3707 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3667 { 3708 {
3668 canUseCompressed = false;
3669 canUseImproved = false; 3709 canUseImproved = false;
3670 } 3710 }
3671 else 3711 }
3672 {
3673 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
3674 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
3675 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
3676 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3677 {
3678 canUseCompressed = false;
3679 }
3680
3681 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
3682 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
3683 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
3684 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
3685 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
3686 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
3687 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
3688 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
3689 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
3690 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
3691 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
3692 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
3693 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
3694 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3695 {
3696 canUseImproved = false;
3697 }
3698 }
3699 3712
3700 #endregion UpdateFlags to packet type conversion 3713 #endregion UpdateFlags to packet type conversion
3701 3714
3702 #region Block Construction 3715 #region Block Construction
3703 3716
3704 // TODO: Remove this once we can build compressed updates 3717 // TODO: Remove this once we can build compressed updates
3705 canUseCompressed = false; 3718 canUseCompressed = false;
3706 3719
3707 if (!canUseImproved && !canUseCompressed) 3720 if (!canUseImproved && !canUseCompressed)
3721 {
3722 if (update.Entity is ScenePresence)
3723 {
3724 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
3725 }
3726 else
3708 { 3727 {
3709 if (update.Entity is ScenePresence)
3710 {
3711 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
3712 }
3713 else
3714 {
3715// if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment) 3728// if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment)
3716// { 3729// {
3717// SceneObjectPart sop = (SceneObjectPart)update.Entity; 3730// SceneObjectPart sop = (SceneObjectPart)update.Entity;
@@ -3740,71 +3753,90 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3740// } 3753// }
3741// else 3754// else
3742// { 3755// {
3743 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); 3756 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
3744// } 3757// }
3745 }
3746 }
3747 else if (!canUseImproved)
3748 {
3749 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
3750 } 3758 }
3759 }
3760 else if (!canUseImproved)
3761 {
3762 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
3763 }
3764 else
3765 {
3766 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId)
3767 // Self updates go into a special list
3768 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3751 else 3769 else
3752 { 3770 // Everything else goes here
3753 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); 3771 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3754 }
3755
3756 #endregion Block Construction
3757 } 3772 }
3758 3773
3759 #region Packet Sending 3774 #endregion Block Construction
3760 3775 }
3761 const float TIME_DILATION = 1.0f; 3776
3762 ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); 3777 #region Packet Sending
3763 3778
3764 if (objectUpdateBlocks.IsValueCreated) 3779 const float TIME_DILATION = 1.0f;
3765 { 3780 ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f);
3766 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; 3781
3782 if (terseAgentUpdateBlocks.IsValueCreated)
3783 {
3784 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
3785
3786 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
3787 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3788 packet.RegionData.TimeDilation = timeDilation;
3789 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3790
3791 for (int i = 0; i < blocks.Count; i++)
3792 packet.ObjectData[i] = blocks[i];
3793
3794 OutPacket(packet, ThrottleOutPacketType.Unknown, true);
3795 }
3796
3797 if (objectUpdateBlocks.IsValueCreated)
3798 {
3799 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
3767 3800
3768 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); 3801 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
3769 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3802 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3770 packet.RegionData.TimeDilation = timeDilation; 3803 packet.RegionData.TimeDilation = timeDilation;
3771 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 3804 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3772 3805
3773 for (int i = 0; i < blocks.Count; i++) 3806 for (int i = 0; i < blocks.Count; i++)
3774 packet.ObjectData[i] = blocks[i]; 3807 packet.ObjectData[i] = blocks[i];
3775 3808
3776 OutPacket(packet, ThrottleOutPacketType.Task, true); 3809 OutPacket(packet, ThrottleOutPacketType.Task, true);
3777 } 3810 }
3778 3811
3779 if (compressedUpdateBlocks.IsValueCreated) 3812 if (compressedUpdateBlocks.IsValueCreated)
3780 { 3813 {
3781 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; 3814 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
3782 3815
3783 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); 3816 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
3784 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3817 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3785 packet.RegionData.TimeDilation = timeDilation; 3818 packet.RegionData.TimeDilation = timeDilation;
3786 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; 3819 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
3787 3820
3788 for (int i = 0; i < blocks.Count; i++) 3821 for (int i = 0; i < blocks.Count; i++)
3789 packet.ObjectData[i] = blocks[i]; 3822 packet.ObjectData[i] = blocks[i];
3790 3823
3791 OutPacket(packet, ThrottleOutPacketType.Task, true); 3824 OutPacket(packet, ThrottleOutPacketType.Task, true);
3792 } 3825 }
3793 3826
3794 if (terseUpdateBlocks.IsValueCreated) 3827 if (terseUpdateBlocks.IsValueCreated)
3795 { 3828 {
3796 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; 3829 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
3797 3830
3798 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 3831 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
3799 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3832 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3800 packet.RegionData.TimeDilation = timeDilation; 3833 packet.RegionData.TimeDilation = timeDilation;
3801 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 3834 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3802 3835
3803 for (int i = 0; i < blocks.Count; i++) 3836 for (int i = 0; i < blocks.Count; i++)
3804 packet.ObjectData[i] = blocks[i]; 3837 packet.ObjectData[i] = blocks[i];
3805 3838
3806 OutPacket(packet, ThrottleOutPacketType.Task, true); 3839 OutPacket(packet, ThrottleOutPacketType.Task, true);
3807 }
3808 } 3840 }
3809 3841
3810 #endregion Packet Sending 3842 #endregion Packet Sending
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index d78931a..e4a2461 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -341,6 +341,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
341 try 341 try
342 { 342 {
343 Request = (HttpWebRequest) WebRequest.Create(Url); 343 Request = (HttpWebRequest) WebRequest.Create(Url);
344
345 //This works around some buggy HTTP Servers like Lighttpd
346 Request.ServicePoint.Expect100Continue = false;
347
344 Request.Method = HttpMethod; 348 Request.Method = HttpMethod;
345 Request.ContentType = HttpMIMEType; 349 Request.ContentType = HttpMIMEType;
346 350
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index 16e25e6..dfba0d6 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -41,8 +41,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41 41
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid 42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
43{ 43{
44 public class RemoteGridServicesConnector : 44 public class RemoteGridServicesConnector : ISharedRegionModule, IGridService
45 GridServicesConnector, ISharedRegionModule, IGridService
46 { 45 {
47 private static readonly ILog m_log = 46 private static readonly ILog m_log =
48 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -51,6 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
51 private bool m_Enabled = false; 50 private bool m_Enabled = false;
52 51
53 private IGridService m_LocalGridService; 52 private IGridService m_LocalGridService;
53 private IGridService m_RemoteGridService;
54 54
55 public RemoteGridServicesConnector() 55 public RemoteGridServicesConnector()
56 { 56 {
@@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
73 get { return "RemoteGridServicesConnector"; } 73 get { return "RemoteGridServicesConnector"; }
74 } 74 }
75 75
76 public override void Initialise(IConfigSource source) 76 public void Initialise(IConfigSource source)
77 { 77 {
78 IConfig moduleConfig = source.Configs["Modules"]; 78 IConfig moduleConfig = source.Configs["Modules"];
79 if (moduleConfig != null) 79 if (moduleConfig != null)
@@ -97,9 +97,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
97 return; 97 return;
98 } 98 }
99 99
100 base.Initialise(source);
101
102 m_LocalGridService = new LocalGridServicesConnector(source); 100 m_LocalGridService = new LocalGridServicesConnector(source);
101 m_RemoteGridService = new GridServicesConnector(source);
103 } 102 }
104 103
105 public void PostInitialise() 104 public void PostInitialise()
@@ -135,61 +134,61 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
135 134
136 #region IGridService 135 #region IGridService
137 136
138 public override string RegisterRegion(UUID scopeID, GridRegion regionInfo) 137 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
139 { 138 {
140 string msg = m_LocalGridService.RegisterRegion(scopeID, regionInfo); 139 string msg = m_LocalGridService.RegisterRegion(scopeID, regionInfo);
141 140
142 if (msg == String.Empty) 141 if (msg == String.Empty)
143 return base.RegisterRegion(scopeID, regionInfo); 142 return m_RemoteGridService.RegisterRegion(scopeID, regionInfo);
144 143
145 return msg; 144 return msg;
146 } 145 }
147 146
148 public override bool DeregisterRegion(UUID regionID) 147 public bool DeregisterRegion(UUID regionID)
149 { 148 {
150 if (m_LocalGridService.DeregisterRegion(regionID)) 149 if (m_LocalGridService.DeregisterRegion(regionID))
151 return base.DeregisterRegion(regionID); 150 return m_RemoteGridService.DeregisterRegion(regionID);
152 151
153 return false; 152 return false;
154 } 153 }
155 154
156 public override List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) 155 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
157 { 156 {
158 return base.GetNeighbours(scopeID, regionID); 157 return m_RemoteGridService.GetNeighbours(scopeID, regionID);
159 } 158 }
160 159
161 public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) 160 public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
162 { 161 {
163 GridRegion rinfo = m_LocalGridService.GetRegionByUUID(scopeID, regionID); 162 GridRegion rinfo = m_LocalGridService.GetRegionByUUID(scopeID, regionID);
164 if (rinfo == null) 163 if (rinfo == null)
165 rinfo = base.GetRegionByUUID(scopeID, regionID); 164 rinfo = m_RemoteGridService.GetRegionByUUID(scopeID, regionID);
166 165
167 return rinfo; 166 return rinfo;
168 } 167 }
169 168
170 public override GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 169 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
171 { 170 {
172 GridRegion rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); 171 GridRegion rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y);
173 if (rinfo == null) 172 if (rinfo == null)
174 rinfo = base.GetRegionByPosition(scopeID, x, y); 173 rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y);
175 174
176 return rinfo; 175 return rinfo;
177 } 176 }
178 177
179 public override GridRegion GetRegionByName(UUID scopeID, string regionName) 178 public GridRegion GetRegionByName(UUID scopeID, string regionName)
180 { 179 {
181 GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); 180 GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName);
182 if (rinfo == null) 181 if (rinfo == null)
183 rinfo = base.GetRegionByName(scopeID, regionName); 182 rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName);
184 183
185 return rinfo; 184 return rinfo;
186 } 185 }
187 186
188 public override List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) 187 public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
189 { 188 {
190 List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber); 189 List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber);
191 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count); 190 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count);
192 List<GridRegion> grinfo = base.GetRegionsByName(scopeID, name, maxNumber); 191 List<GridRegion> grinfo = m_RemoteGridService.GetRegionsByName(scopeID, name, maxNumber);
193 192
194 if (grinfo != null) 193 if (grinfo != null)
195 { 194 {
@@ -202,13 +201,79 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
202 return rinfo; 201 return rinfo;
203 } 202 }
204 203
205 // Let's not override GetRegionRange -- let's get them all from the grid server 204 public virtual List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
205 {
206 List<GridRegion> rinfo = m_LocalGridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
207 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionRange {0} found {1} regions", name, rinfo.Count);
208 List<GridRegion> grinfo = m_RemoteGridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
209
210 if (grinfo != null)
211 {
212 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionRange {0} found {1} regions", name, grinfo.Count);
213 foreach (GridRegion r in grinfo)
214 if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
215 rinfo.Add(r);
216 }
217
218 return rinfo;
219 }
220
221 public List<GridRegion> GetDefaultRegions(UUID scopeID)
222 {
223 List<GridRegion> rinfo = m_LocalGridService.GetDefaultRegions(scopeID);
224 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetDefaultRegions {0} found {1} regions", name, rinfo.Count);
225 List<GridRegion> grinfo = m_RemoteGridService.GetDefaultRegions(scopeID);
226
227 if (grinfo != null)
228 {
229 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetDefaultRegions {0} found {1} regions", name, grinfo.Count);
230 foreach (GridRegion r in grinfo)
231 if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
232 rinfo.Add(r);
233 }
234
235 return rinfo;
236 }
237
238 public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
239 {
240 List<GridRegion> rinfo = m_LocalGridService.GetFallbackRegions(scopeID, x, y);
241 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetFallbackRegions {0} found {1} regions", name, rinfo.Count);
242 List<GridRegion> grinfo = m_RemoteGridService.GetFallbackRegions(scopeID, x, y);
243
244 if (grinfo != null)
245 {
246 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetFallbackRegions {0} found {1} regions", name, grinfo.Count);
247 foreach (GridRegion r in grinfo)
248 if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
249 rinfo.Add(r);
250 }
251
252 return rinfo;
253 }
254
255 public List<GridRegion> GetHyperlinks(UUID scopeID)
256 {
257 List<GridRegion> rinfo = m_LocalGridService.GetHyperlinks(scopeID);
258 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetHyperlinks {0} found {1} regions", name, rinfo.Count);
259 List<GridRegion> grinfo = m_RemoteGridService.GetHyperlinks(scopeID);
260
261 if (grinfo != null)
262 {
263 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetHyperlinks {0} found {1} regions", name, grinfo.Count);
264 foreach (GridRegion r in grinfo)
265 if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
266 rinfo.Add(r);
267 }
268
269 return rinfo;
270 }
206 271
207 public override int GetRegionFlags(UUID scopeID, UUID regionID) 272 public int GetRegionFlags(UUID scopeID, UUID regionID)
208 { 273 {
209 int flags = m_LocalGridService.GetRegionFlags(scopeID, regionID); 274 int flags = m_LocalGridService.GetRegionFlags(scopeID, regionID);
210 if (flags == -1) 275 if (flags == -1)
211 flags = base.GetRegionFlags(scopeID, regionID); 276 flags = m_RemoteGridService.GetRegionFlags(scopeID, regionID);
212 277
213 return flags; 278 return flags;
214 } 279 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index d2c3afb..334dcb0 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -93,13 +93,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
93 } 93 }
94 94
95 // try to fetch from GridServer 95 // try to fetch from GridServer
96 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(UUID.Zero, mapName, 20); 96 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
97 if (regionInfos == null) 97 if (regionInfos == null)
98 { 98 {
99 m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?"); 99 m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?");
100 // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region 100 // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region
101 regionInfos = new List<GridRegion>(); 101 regionInfos = new List<GridRegion>();
102 GridRegion info = m_scene.GridService.GetRegionByName(UUID.Zero, mapName); 102 GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName);
103 if (info != null) regionInfos.Add(info); 103 if (info != null) regionInfos.Add(info);
104 } 104 }
105 105
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 9869f4a..e3ba190 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -33,6 +33,7 @@ using System.Drawing.Imaging;
33using System.IO; 33using System.IO;
34using System.Net; 34using System.Net;
35using System.Reflection; 35using System.Reflection;
36using System.Runtime.Remoting.Messaging;
36using System.Threading; 37using System.Threading;
37using log4net; 38using log4net;
38using Nini.Config; 39using Nini.Config;
@@ -413,11 +414,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
413 } 414 }
414 } 415 }
415 416
417 private int nAsyncRequests = 0;
416 /// <summary> 418 /// <summary>
417 /// Processing thread main() loop for doing remote mapitem requests 419 /// Processing thread main() loop for doing remote mapitem requests
418 /// </summary> 420 /// </summary>
419 public void process() 421 public void process()
420 { 422 {
423 const int MAX_ASYNC_REQUESTS = 20;
421 try 424 try
422 { 425 {
423 while (true) 426 while (true)
@@ -437,10 +440,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
437 dorequest = false; 440 dorequest = false;
438 } 441 }
439 442
440 if (dorequest) 443 if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle))
441 { 444 {
442 OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); 445 while (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break
443 RequestMapItemsCompleted(response); 446 Thread.Sleep(80);
447
448 RequestMapItemsDelegate d = RequestMapItemsAsync;
449 d.BeginInvoke(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle, RequestMapItemsCompleted, null);
450 //OSDMap response = RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
451 //RequestMapItemsCompleted(response);
452 Interlocked.Increment(ref nAsyncRequests);
444 } 453 }
445 } 454 }
446 455
@@ -469,8 +478,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
469 /// Sends the mapitem response to the IClientAPI 478 /// Sends the mapitem response to the IClientAPI
470 /// </summary> 479 /// </summary>
471 /// <param name="response">The OSDMap Response for the mapitem</param> 480 /// <param name="response">The OSDMap Response for the mapitem</param>
472 private void RequestMapItemsCompleted(OSDMap response) 481 private void RequestMapItemsCompleted(IAsyncResult iar)
473 { 482 {
483 AsyncResult result = (AsyncResult)iar;
484 RequestMapItemsDelegate icon = (RequestMapItemsDelegate)result.AsyncDelegate;
485
486 OSDMap response = (OSDMap)icon.EndInvoke(iar);
487
488 Interlocked.Decrement(ref nAsyncRequests);
489
490 if (!response.ContainsKey("requestID"))
491 return;
492
474 UUID requestID = response["requestID"].AsUUID(); 493 UUID requestID = response["requestID"].AsUUID();
475 494
476 if (requestID != UUID.Zero) 495 if (requestID != UUID.Zero)
@@ -538,6 +557,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
538 EnqueueMapItemRequest(st); 557 EnqueueMapItemRequest(st);
539 } 558 }
540 559
560 private delegate OSDMap RequestMapItemsDelegate(UUID id, uint flags,
561 uint EstateID, bool godlike, uint itemtype, ulong regionhandle);
541 /// <summary> 562 /// <summary>
542 /// Does the actual remote mapitem request 563 /// Does the actual remote mapitem request
543 /// This should be called from an asynchronous thread 564 /// This should be called from an asynchronous thread
@@ -552,9 +573,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
552 /// <param name="itemtype">passed in from packet</param> 573 /// <param name="itemtype">passed in from packet</param>
553 /// <param name="regionhandle">Region we're looking up</param> 574 /// <param name="regionhandle">Region we're looking up</param>
554 /// <returns></returns> 575 /// <returns></returns>
555 private OSDMap RequestMapItemsAsync(string httpserver, UUID id, uint flags, 576 private OSDMap RequestMapItemsAsync(UUID id, uint flags,
556 uint EstateID, bool godlike, uint itemtype, ulong regionhandle) 577 uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
557 { 578 {
579 string httpserver = "";
558 bool blacklisted = false; 580 bool blacklisted = false;
559 lock (m_blacklistedregions) 581 lock (m_blacklistedregions)
560 { 582 {
@@ -593,7 +615,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
593 if (!m_blacklistedregions.ContainsKey(regionhandle)) 615 if (!m_blacklistedregions.ContainsKey(regionhandle))
594 m_blacklistedregions.Add(regionhandle, Environment.TickCount); 616 m_blacklistedregions.Add(regionhandle, Environment.TickCount);
595 } 617 }
596 m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString()); 618 //m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString());
597 } 619 }
598 } 620 }
599 621
@@ -638,7 +660,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
638 os = mapitemsrequest.GetRequestStream(); 660 os = mapitemsrequest.GetRequestStream();
639 os.Write(buffer, 0, buffer.Length); //Send it 661 os.Write(buffer, 0, buffer.Length); //Send it
640 os.Close(); 662 os.Close();
641 //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from Sim {0}", httpserver); 663 //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from {0}", httpserver);
642 } 664 }
643 catch (WebException ex) 665 catch (WebException ex)
644 { 666 {
@@ -654,15 +676,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
654 676
655 return responseMap; 677 return responseMap;
656 } 678 }
679 catch
680 {
681 m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver);
682 responseMap["connect"] = OSD.FromBoolean(false);
683 return responseMap;
684 }
657 685
658 string response_mapItems_reply = null; 686 string response_mapItems_reply = null;
659 { // get the response 687 { // get the response
688 StreamReader sr = null;
660 try 689 try
661 { 690 {
662 WebResponse webResponse = mapitemsrequest.GetResponse(); 691 WebResponse webResponse = mapitemsrequest.GetResponse();
663 if (webResponse != null) 692 if (webResponse != null)
664 { 693 {
665 StreamReader sr = new StreamReader(webResponse.GetResponseStream()); 694 sr = new StreamReader(webResponse.GetResponseStream());
666 response_mapItems_reply = sr.ReadToEnd().Trim(); 695 response_mapItems_reply = sr.ReadToEnd().Trim();
667 } 696 }
668 else 697 else
@@ -683,6 +712,24 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
683 712
684 return responseMap; 713 return responseMap;
685 } 714 }
715 catch
716 {
717 m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver);
718 responseMap["connect"] = OSD.FromBoolean(false);
719 lock (m_blacklistedregions)
720 {
721 if (!m_blacklistedregions.ContainsKey(regionhandle))
722 m_blacklistedregions.Add(regionhandle, Environment.TickCount);
723 }
724
725 return responseMap;
726 }
727 finally
728 {
729 if (sr != null)
730 sr.Close();
731 }
732
686 OSD rezResponse = null; 733 OSD rezResponse = null;
687 try 734 try
688 { 735 {
@@ -691,14 +738,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
691 responseMap = (OSDMap)rezResponse; 738 responseMap = (OSDMap)rezResponse;
692 responseMap["requestID"] = OSD.FromUUID(requestID); 739 responseMap["requestID"] = OSD.FromUUID(requestID);
693 } 740 }
694 catch (Exception) 741 catch (Exception ex)
695 { 742 {
696 //m_log.InfoFormat("[OGP]: exception on parse of rez reply {0}", ex.Message); 743 m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message);
697 responseMap["connect"] = OSD.FromBoolean(false); 744 responseMap["connect"] = OSD.FromBoolean(false);
745 lock (m_blacklistedregions)
746 {
747 if (!m_blacklistedregions.ContainsKey(regionhandle))
748 m_blacklistedregions.Add(regionhandle, Environment.TickCount);
749 }
698 750
699 return responseMap; 751 return responseMap;
700 } 752 }
701 } 753 }
754
755 if (!responseMap.ContainsKey(itemtype.ToString())) // remote sim doesnt have the stated region handle
756 {
757 if (!m_blacklistedregions.ContainsKey(regionhandle))
758 {
759 m_log.DebugFormat("[WORLD MAP]: Remote sim does not have the stated region. Blacklisting.");
760 m_blacklistedregions.Add(regionhandle, Environment.TickCount);
761 }
762 }
763
702 return responseMap; 764 return responseMap;
703 } 765 }
704 766
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index b3b99f4..39116b6 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -43,13 +43,14 @@ using OpenSim.Tests.Common.Setup;
43namespace OpenSim.Region.Framework.Scenes.Tests 43namespace OpenSim.Region.Framework.Scenes.Tests
44{ 44{
45 /// <summary> 45 /// <summary>
46 /// Tests manipulation of scene objects by users. 46 /// Tests derez of scene objects by users.
47 /// </summary> 47 /// </summary>
48 /// 48 /// <remarks>
49 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. 49 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly.
50 /// FIXME: These tests are very incomplete - they only test for a few conditions. 50 /// TODO: These tests are very incomplete - they only test for a few conditions.
51 /// </remarks>
51 [TestFixture] 52 [TestFixture]
52 public class SceneObjectUserTests 53 public class SceneObjectDeRezTests
53 { 54 {
54 /// <summary> 55 /// <summary>
55 /// Test deleting an object from a scene. 56 /// Test deleting an object from a scene.
@@ -122,6 +123,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
122 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); 123 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
123 sogd.InventoryDeQueueAndDelete(); 124 sogd.InventoryDeQueueAndDelete();
124 125
126 // Object should still be in the scene.
125 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 127 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
126 Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); 128 Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
127 } 129 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
new file mode 100644
index 0000000..c78038f
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
@@ -0,0 +1,87 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using Nini.Config;
32using NUnit.Framework;
33using NUnit.Framework.SyntaxHelpers;
34using OpenMetaverse;
35using OpenSim.Framework;
36using OpenSim.Framework.Communications;
37using OpenSim.Region.CoreModules.Avatar.InstantMessage;
38using OpenSim.Region.CoreModules.World.Permissions;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
42using OpenSim.Tests.Common;
43using OpenSim.Tests.Common.Mock;
44using OpenSim.Tests.Common.Setup;
45
46namespace OpenSim.Region.Framework.Scenes.Tests
47{
48 [TestFixture]
49 public class SceneObjectUserGroupTests
50 {
51 /// <summary>
52 /// Test share with group object functionality
53 /// </summary>
54 /// <remarks>This test is not yet fully implemented</remarks>
55 [Test]
56 public void TestShareWithGroup()
57 {
58 TestHelper.InMethod();
59// log4net.Config.XmlConfigurator.Configure();
60
61 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
62
63 TestScene scene = SceneSetupHelpers.SetupScene();
64 IConfigSource configSource = new IniConfigSource();
65
66 IConfig startupConfig = configSource.AddConfig("Startup");
67 startupConfig.Set("serverside_object_permissions", true);
68
69 IConfig groupsConfig = configSource.AddConfig("Groups");
70 groupsConfig.Set("Enabled", true);
71 groupsConfig.Set("Module", "GroupsModule");
72 groupsConfig.Set("DebugEnabled", true);
73
74 SceneSetupHelpers.SetupSceneModules(
75 scene, configSource, new object[]
76 { new PermissionsModule(),
77 new GroupsModule(),
78 new MockGroupsServicesConnector() });
79
80 TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId);
81
82 IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>();
83
84 groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true);
85 }
86 }
87} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index ccf5289..4aab87f 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -163,9 +163,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
163 if (m_msgTransferModule == null) 163 if (m_msgTransferModule == null)
164 { 164 {
165 m_groupsEnabled = false; 165 m_groupsEnabled = false;
166 m_log.Error("[GROUPS]: Could not get MessageTransferModule"); 166 m_log.Warn("[GROUPS]: Could not get MessageTransferModule");
167 Close();
168 return;
169 } 167 }
170 } 168 }
171 169
@@ -1299,7 +1297,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1299 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is local, delivering directly", localClient.Name); 1297 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is local, delivering directly", localClient.Name);
1300 localClient.SendInstantMessage(msg); 1298 localClient.SendInstantMessage(msg);
1301 } 1299 }
1302 else 1300 else if (m_msgTransferModule != null)
1303 { 1301 {
1304 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is not local, delivering via TransferModule", msgTo); 1302 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is not local, delivering via TransferModule", msgTo);
1305 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Message Sent: {0}", success?"Succeeded":"Failed"); }); 1303 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Message Sent: {0}", success?"Succeeded":"Failed"); });
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
index a046e09..5c779de 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
@@ -27,14 +27,12 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30
31using OpenMetaverse; 30using OpenMetaverse;
32
33using OpenSim.Framework; 31using OpenSim.Framework;
34 32
35namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups 33namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
36{ 34{
37 interface IGroupsServicesConnector 35 public interface IGroupsServicesConnector
38 { 36 {
39 UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); 37 UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID);
40 void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); 38 void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
new file mode 100644
index 0000000..bc55b04
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
@@ -0,0 +1,65 @@
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
28using System;
29using System.Reflection;
30using Nini.Config;
31using NUnit.Framework;
32using NUnit.Framework.SyntaxHelpers;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Tests.Common;
38using OpenSim.Tests.Common.Mock;
39using OpenSim.Tests.Common.Setup;
40
41namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
42{
43 /// <summary>
44 /// Basic groups module tests
45 /// </summary>
46 [TestFixture]
47 public class GroupsModuleTests
48 {
49 [Test]
50 public void TestBasic()
51 {
52 TestHelper.InMethod();
53// log4net.Config.XmlConfigurator.Configure();
54
55 TestScene scene = SceneSetupHelpers.SetupScene();
56 IConfigSource configSource = new IniConfigSource();
57 IConfig config = configSource.AddConfig("Groups");
58 config.Set("Enabled", true);
59 config.Set("Module", "GroupsModule");
60 config.Set("DebugEnabled", true);
61 SceneSetupHelpers.SetupSceneModules(
62 scene, configSource, new object[] { new MockGroupsServicesConnector() });
63 }
64 }
65} \ No newline at end of file
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 1ac8478..a1d9167 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -147,7 +147,10 @@ namespace OpenSim.Services.Connectors.Hypergrid
147 public UUID GetMapImage(UUID regionID, string imageURL, string storagePath) 147 public UUID GetMapImage(UUID regionID, string imageURL, string storagePath)
148 { 148 {
149 if (m_AssetService == null) 149 if (m_AssetService == null)
150 {
151 m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: No AssetService defined. Map tile not retrieved.");
150 return m_HGMapImage; 152 return m_HGMapImage;
153 }
151 154
152 UUID mapTile = m_HGMapImage; 155 UUID mapTile = m_HGMapImage;
153 string filename = string.Empty; 156 string filename = string.Empty;
@@ -167,8 +170,6 @@ namespace OpenSim.Services.Connectors.Hypergrid
167 // !!! for now 170 // !!! for now
168 //info.RegionSettings.TerrainImageID = ass.FullID; 171 //info.RegionSettings.TerrainImageID = ass.FullID;
169 172
170 ass.Temporary = true;
171 ass.Local = true;
172 ass.Data = imageData; 173 ass.Data = imageData;
173 174
174 m_AssetService.Store(ass); 175 m_AssetService.Store(ass);
diff --git a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs
new file mode 100644
index 0000000..6fb9df1
--- /dev/null
+++ b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs
@@ -0,0 +1,237 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using OpenMetaverse;
35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
39
40namespace OpenSim.Tests.Common.Mock
41{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
43 public class MockGroupsServicesConnector : ISharedRegionModule, IGroupsServicesConnector
44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
47 public string Name
48 {
49 get { return "MockGroupsServicesConnector"; }
50 }
51
52 public Type ReplaceableInterface
53 {
54 get { return null; }
55 }
56
57 public void Initialise(IConfigSource config)
58 {
59 }
60
61 public void Close()
62 {
63 }
64
65 public void AddRegion(Scene scene)
66 {
67 m_log.DebugFormat("[MOCK GROUPS SERVICES CONNECTOR]: Adding to region {0}", scene.RegionInfo.RegionName);
68 scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
69 }
70
71 public void RemoveRegion(Scene scene)
72 {
73 }
74
75 public void RegionLoaded(Scene scene)
76 {
77 }
78
79 public void PostInitialise()
80 {
81 }
82
83 public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID,
84 int membershipFee, bool openEnrollment, bool allowPublish,
85 bool maturePublish, UUID founderID)
86 {
87 return UUID.Zero;
88 }
89
90 public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList,
91 UUID insigniaID, int membershipFee, bool openEnrollment,
92 bool allowPublish, bool maturePublish)
93 {
94 }
95
96 public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
97 string title, ulong powers)
98 {
99 }
100
101 public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID)
102 {
103 }
104
105 public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
106 string title, ulong powers)
107 {
108 }
109
110 public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName)
111 {
112 return null;
113 }
114
115 public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID)
116 {
117 return default(GroupProfileData);
118 }
119
120 public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
121 {
122 }
123
124 public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
125 {
126 }
127
128 public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile)
129 {
130 }
131
132 public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID)
133 {
134 }
135
136 public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
137 {
138 return null;
139 }
140
141 public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
142 {
143 }
144
145 public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
146 {
147 }
148
149 public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
150 {
151 }
152
153 public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
154 {
155 }
156
157 public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
158 {
159 }
160
161 public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search)
162 {
163 return null;
164 }
165
166 public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID)
167 {
168 return null;
169 }
170
171 public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID)
172 {
173 return null;
174 }
175
176 public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID)
177 {
178 return new List<GroupMembershipData>();
179 }
180
181 public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID)
182 {
183 return null;
184 }
185
186 public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID)
187 {
188 return null;
189 }
190
191 public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID)
192 {
193 return null;
194 }
195
196 public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
197 {
198 return null;
199 }
200
201 public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID)
202 {
203 return null;
204 }
205
206 public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)
207 {
208 return null;
209 }
210
211 public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
212 {
213 }
214
215 public void ResetAgentGroupChatSessions(UUID agentID)
216 {
217 }
218
219 public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID)
220 {
221 return false;
222 }
223
224 public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID)
225 {
226 return false;
227 }
228
229 public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID)
230 {
231 }
232
233 public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID)
234 {
235 }
236 }
237} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 9d7733e..8b16496 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -424,9 +424,12 @@ namespace OpenSim.Tests.Common.Setup
424 foreach (IRegionModuleBase module in newModules) 424 foreach (IRegionModuleBase module in newModules)
425 { 425 {
426 module.AddRegion(scene); 426 module.AddRegion(scene);
427 module.RegionLoaded(scene);
428 scene.AddRegionModule(module.Name, module); 427 scene.AddRegionModule(module.Name, module);
429 } 428 }
429
430 // RegionLoaded is fired after all modules have been appropriately added to all scenes
431 foreach (IRegionModuleBase module in newModules)
432 module.RegionLoaded(scene);
430 433
431 scene.SetModuleInterfaces(); 434 scene.SetModuleInterfaces();
432 } 435 }