Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Melanie 2010-12-15 08:18:02 +01:00
commit ee1e725e39
16 changed files with 827 additions and 191 deletions

View File

@ -128,6 +128,11 @@
</exec> </exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" /> <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.optionalmodules.tests">
<arg value="./bin/OpenSim.Region.OptionalModules.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.optionalmodules.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.framework.tests"> <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.framework.tests">
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" /> <arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
</exec> </exec>
@ -202,6 +207,17 @@
<arg value="--export-html=./cov/OpenSim.Region.CoreModules ./cov/OpenSim.Region.CoreModules.cov" /> <arg value="--export-html=./cov/OpenSim.Region.CoreModules ./cov/OpenSim.Region.CoreModules.cov" />
</exec> </exec>
<exec program="mono">
<arg value="--debug" />
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.OptionalModules.cov,+[OpenSim.Region.OptionalModules]" />
<arg value="/usr/lib/nunit/nunit-console.exe" />
<arg value="./bin/OpenSim.Region.OptionalModules.Tests.dll" />
</exec>
<delete dir="./cov/OpenSim.Region.OptionalModules" />
<exec program="monocov">
<arg value="--export-html=./cov/OpenSim.Region.OptionalModules ./cov/OpenSim.Region.OptionalModules.cov" />
</exec>
<exec program="mono"> <exec program="mono">
<arg value="--debug" /> <arg value="--debug" />
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.Framework.cov,+[OpenSim.Region.Framework]" /> <arg value="--profile=monocov:outfile=./cov/OpenSim.Region.Framework.cov,+[OpenSim.Region.Framework]" />
@ -298,6 +314,11 @@
<arg value="-xml=test-results/OpenSim.Region.CoreModules.Tests.dll-Results.xml" /> <arg value="-xml=test-results/OpenSim.Region.CoreModules.Tests.dll-Results.xml" />
</exec> </exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.optionalmodules.tests">
<arg value="./bin/OpenSim.Region.OptionalModules.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Region.OptionalModules.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.framework.tests"> <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.framework.tests">
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" /> <arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Region.Framework.Tests.dll-Results.xml" /> <arg value="-xml=test-results/OpenSim.Region.Framework.Tests.dll-Results.xml" />
@ -314,6 +335,7 @@
<!-- <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" /> --> <!-- <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" /> -->
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" /> <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" /> <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.optionalmodules.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" /> <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" /> <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
@ -338,6 +360,7 @@
<!-- <include name="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" /> --> <!-- <include name="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" /> -->
<!-- <include name="./bin/OpenSim.Region.ScriptEngine.Tests.dll" /> --> <!-- <include name="./bin/OpenSim.Region.ScriptEngine.Tests.dll" /> -->
<!-- <include name="./bin/OpenSim.Region.CoreModules.Tests.dll" /> --> <!-- <include name="./bin/OpenSim.Region.CoreModules.Tests.dll" /> -->
<!-- <include name="./bin/OpenSim.Region.OptionalModules.Tests.dll" /> -->
<!-- <include name="./bin/OpenSim.Region.Framework.Tests.dll" /> --> <!-- <include name="./bin/OpenSim.Region.Framework.Tests.dll" /> -->
<!-- <include name="./bin/OpenSim.Data.SQLite.Tests.dll" /> --> <!-- <include name="./bin/OpenSim.Data.SQLite.Tests.dll" /> -->
<!-- <include name="./bin/OpenSim.Data.MySQL.Tests.dll" /> --> <!-- <include name="./bin/OpenSim.Data.MySQL.Tests.dll" /> -->

View File

@ -3589,129 +3589,142 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
int updatesThisCall = 0; int updatesThisCall = 0;
lock (m_entityUpdates.SyncRoot) EntityUpdate update;
while (updatesThisCall < maxUpdates)
{ {
EntityUpdate update; lock (m_entityUpdates.SyncRoot)
while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update)) if (!m_entityUpdates.TryDequeue(out update))
break;
if (update.Entity is SceneObjectPart)
{ {
if (update.Entity is SceneObjectPart) SceneObjectPart part = (SceneObjectPart)update.Entity;
{
SceneObjectPart part = (SceneObjectPart)update.Entity; // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) // will never receive an update after a prim kill. Even then, keeping the kill record may be a good
// safety measure.
//
// If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
// after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
// updates and kills on different threads with different scheduling strategies, hence this protection.
//
// This doesn't appear to apply to child prims - a client will happily ignore these updates
// after the root prim has been deleted.
if (m_killRecord.Contains(part.LocalId))
continue;
if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId))
continue;
if (part.ParentGroup.IsDeleted)
continue;
if (part.ParentGroup.IsAttachment)
{ // Someone else's HUD, why are we getting these?
if (part.ParentGroup.OwnerID != AgentId &&
part.ParentGroup.RootPart.Shape.State >= 30)
continue;
ScenePresence sp;
// Owner is not in the sim, don't update it to
// anyone
if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
continue; continue;
if (m_killRecord.Contains(part.LocalId)) List<SceneObjectGroup> atts = sp.Attachments;
continue; bool found = false;
foreach (SceneObjectGroup att in atts)
if (part.ParentGroup.IsDeleted)
continue;
if (part.ParentGroup.IsAttachment)
{ // Someone else's HUD, why are we getting these?
if (part.ParentGroup.OwnerID != AgentId &&
part.ParentGroup.RootPart.Shape.State >= 30)
continue;
ScenePresence sp;
// Owner is not in the sim, don't update it to
// anyone
if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
continue;
List<SceneObjectGroup> atts = sp.Attachments;
bool found = false;
foreach (SceneObjectGroup att in atts)
{
if (att == part.ParentGroup)
{
found = true;
break;
}
}
// It's an attachment of a valid avatar, but
// doesn't seem to be attached, skip
if (!found)
continue;
}
if (part.ParentGroup.IsAttachment && m_disableFacelights)
{ {
if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && if (att == part.ParentGroup)
part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
{ {
part.Shape.LightEntry = false; found = true;
break;
} }
} }
// It's an attachment of a valid avatar, but
// doesn't seem to be attached, skip
if (!found)
continue;
} }
++updatesThisCall; if (part.ParentGroup.IsAttachment && m_disableFacelights)
{
if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
{
part.Shape.LightEntry = false;
}
}
}
#region UpdateFlags to packet type conversion ++updatesThisCall;
PrimUpdateFlags updateFlags = update.Flags; #region UpdateFlags to packet type conversion
bool canUseCompressed = true; PrimUpdateFlags updateFlags = update.Flags;
bool canUseImproved = true;
// Compressed object updates only make sense for LL primitives bool canUseCompressed = true;
if (!(update.Entity is SceneObjectPart)) bool canUseImproved = true;
// Compressed object updates only make sense for LL primitives
if (!(update.Entity is SceneObjectPart))
{
canUseCompressed = false;
}
if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
{
canUseCompressed = false;
canUseImproved = false;
}
else
{
if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
updateFlags.HasFlag(PrimUpdateFlags.Joint))
{ {
canUseCompressed = false; canUseCompressed = false;
} }
if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
updateFlags.HasFlag(PrimUpdateFlags.Text) ||
updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
updateFlags.HasFlag(PrimUpdateFlags.Material) ||
updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
updateFlags.HasFlag(PrimUpdateFlags.Joint))
{ {
canUseCompressed = false;
canUseImproved = false; canUseImproved = false;
} }
}
#endregion UpdateFlags to packet type conversion
#region Block Construction
// TODO: Remove this once we can build compressed updates
canUseCompressed = false;
if (!canUseImproved && !canUseCompressed)
{
if (update.Entity is ScenePresence)
{
objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
}
else else
{ {
if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
updateFlags.HasFlag(PrimUpdateFlags.Joint))
{
canUseCompressed = false;
}
if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
updateFlags.HasFlag(PrimUpdateFlags.Text) ||
updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
updateFlags.HasFlag(PrimUpdateFlags.Material) ||
updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
updateFlags.HasFlag(PrimUpdateFlags.Joint))
{
canUseImproved = false;
}
}
#endregion UpdateFlags to packet type conversion
#region Block Construction
// TODO: Remove this once we can build compressed updates
canUseCompressed = false;
if (!canUseImproved && !canUseCompressed)
{
if (update.Entity is ScenePresence)
{
objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
}
else
{
// if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment) // if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment)
// { // {
// SceneObjectPart sop = (SceneObjectPart)update.Entity; // SceneObjectPart sop = (SceneObjectPart)update.Entity;
@ -3740,71 +3753,90 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// } // }
// else // else
// { // {
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
// } // }
}
}
else if (!canUseImproved)
{
compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
} }
}
else if (!canUseImproved)
{
compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
}
else
{
if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId)
// Self updates go into a special list
terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
else else
{ // Everything else goes here
terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
}
#endregion Block Construction
} }
#region Packet Sending #endregion Block Construction
}
const float TIME_DILATION = 1.0f; #region Packet Sending
ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f);
if (objectUpdateBlocks.IsValueCreated) const float TIME_DILATION = 1.0f;
{ ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f);
List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); if (terseAgentUpdateBlocks.IsValueCreated)
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; {
packet.RegionData.TimeDilation = timeDilation; List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
for (int i = 0; i < blocks.Count; i++) ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
packet.ObjectData[i] = blocks[i]; packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
packet.RegionData.TimeDilation = timeDilation;
packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
OutPacket(packet, ThrottleOutPacketType.Task, true); for (int i = 0; i < blocks.Count; i++)
} packet.ObjectData[i] = blocks[i];
if (compressedUpdateBlocks.IsValueCreated) OutPacket(packet, ThrottleOutPacketType.Unknown, true);
{ }
List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); if (objectUpdateBlocks.IsValueCreated)
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; {
packet.RegionData.TimeDilation = timeDilation; List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
for (int i = 0; i < blocks.Count; i++) ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
packet.ObjectData[i] = blocks[i]; packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
packet.RegionData.TimeDilation = timeDilation;
packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
OutPacket(packet, ThrottleOutPacketType.Task, true); for (int i = 0; i < blocks.Count; i++)
} packet.ObjectData[i] = blocks[i];
if (terseUpdateBlocks.IsValueCreated) OutPacket(packet, ThrottleOutPacketType.Task, true);
{ }
List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); if (compressedUpdateBlocks.IsValueCreated)
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; {
packet.RegionData.TimeDilation = timeDilation; List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
for (int i = 0; i < blocks.Count; i++) ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
packet.ObjectData[i] = blocks[i]; packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
packet.RegionData.TimeDilation = timeDilation;
packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
OutPacket(packet, ThrottleOutPacketType.Task, true); for (int i = 0; i < blocks.Count; i++)
} packet.ObjectData[i] = blocks[i];
OutPacket(packet, ThrottleOutPacketType.Task, true);
}
if (terseUpdateBlocks.IsValueCreated)
{
List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
packet.RegionData.TimeDilation = timeDilation;
packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
for (int i = 0; i < blocks.Count; i++)
packet.ObjectData[i] = blocks[i];
OutPacket(packet, ThrottleOutPacketType.Task, true);
} }
#endregion Packet Sending #endregion Packet Sending

View File

@ -341,6 +341,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
try try
{ {
Request = (HttpWebRequest) WebRequest.Create(Url); Request = (HttpWebRequest) WebRequest.Create(Url);
//This works around some buggy HTTP Servers like Lighttpd
Request.ServicePoint.Expect100Continue = false;
Request.Method = HttpMethod; Request.Method = HttpMethod;
Request.ContentType = HttpMIMEType; Request.ContentType = HttpMIMEType;

View File

@ -41,8 +41,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
{ {
public class RemoteGridServicesConnector : public class RemoteGridServicesConnector : ISharedRegionModule, IGridService
GridServicesConnector, ISharedRegionModule, IGridService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -51,6 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
private bool m_Enabled = false; private bool m_Enabled = false;
private IGridService m_LocalGridService; private IGridService m_LocalGridService;
private IGridService m_RemoteGridService;
public RemoteGridServicesConnector() public RemoteGridServicesConnector()
{ {
@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
get { return "RemoteGridServicesConnector"; } get { return "RemoteGridServicesConnector"; }
} }
public override void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig moduleConfig = source.Configs["Modules"]; IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null) if (moduleConfig != null)
@ -97,9 +97,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return; return;
} }
base.Initialise(source);
m_LocalGridService = new LocalGridServicesConnector(source); m_LocalGridService = new LocalGridServicesConnector(source);
m_RemoteGridService = new GridServicesConnector(source);
} }
public void PostInitialise() public void PostInitialise()
@ -135,61 +134,61 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
#region IGridService #region IGridService
public override string RegisterRegion(UUID scopeID, GridRegion regionInfo) public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
{ {
string msg = m_LocalGridService.RegisterRegion(scopeID, regionInfo); string msg = m_LocalGridService.RegisterRegion(scopeID, regionInfo);
if (msg == String.Empty) if (msg == String.Empty)
return base.RegisterRegion(scopeID, regionInfo); return m_RemoteGridService.RegisterRegion(scopeID, regionInfo);
return msg; return msg;
} }
public override bool DeregisterRegion(UUID regionID) public bool DeregisterRegion(UUID regionID)
{ {
if (m_LocalGridService.DeregisterRegion(regionID)) if (m_LocalGridService.DeregisterRegion(regionID))
return base.DeregisterRegion(regionID); return m_RemoteGridService.DeregisterRegion(regionID);
return false; return false;
} }
public override List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
{ {
return base.GetNeighbours(scopeID, regionID); return m_RemoteGridService.GetNeighbours(scopeID, regionID);
} }
public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
{ {
GridRegion rinfo = m_LocalGridService.GetRegionByUUID(scopeID, regionID); GridRegion rinfo = m_LocalGridService.GetRegionByUUID(scopeID, regionID);
if (rinfo == null) if (rinfo == null)
rinfo = base.GetRegionByUUID(scopeID, regionID); rinfo = m_RemoteGridService.GetRegionByUUID(scopeID, regionID);
return rinfo; return rinfo;
} }
public override GridRegion GetRegionByPosition(UUID scopeID, int x, int y) public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
{ {
GridRegion rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); GridRegion rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y);
if (rinfo == null) if (rinfo == null)
rinfo = base.GetRegionByPosition(scopeID, x, y); rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y);
return rinfo; return rinfo;
} }
public override GridRegion GetRegionByName(UUID scopeID, string regionName) public GridRegion GetRegionByName(UUID scopeID, string regionName)
{ {
GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName);
if (rinfo == null) if (rinfo == null)
rinfo = base.GetRegionByName(scopeID, regionName); rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName);
return rinfo; return rinfo;
} }
public override List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
{ {
List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber); List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber);
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count); //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count);
List<GridRegion> grinfo = base.GetRegionsByName(scopeID, name, maxNumber); List<GridRegion> grinfo = m_RemoteGridService.GetRegionsByName(scopeID, name, maxNumber);
if (grinfo != null) if (grinfo != null)
{ {
@ -202,13 +201,79 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return rinfo; return rinfo;
} }
// Let's not override GetRegionRange -- let's get them all from the grid server public virtual List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
{
List<GridRegion> rinfo = m_LocalGridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionRange {0} found {1} regions", name, rinfo.Count);
List<GridRegion> grinfo = m_RemoteGridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
public override int GetRegionFlags(UUID scopeID, UUID regionID) if (grinfo != null)
{
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionRange {0} found {1} regions", name, grinfo.Count);
foreach (GridRegion r in grinfo)
if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
rinfo.Add(r);
}
return rinfo;
}
public List<GridRegion> GetDefaultRegions(UUID scopeID)
{
List<GridRegion> rinfo = m_LocalGridService.GetDefaultRegions(scopeID);
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetDefaultRegions {0} found {1} regions", name, rinfo.Count);
List<GridRegion> grinfo = m_RemoteGridService.GetDefaultRegions(scopeID);
if (grinfo != null)
{
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetDefaultRegions {0} found {1} regions", name, grinfo.Count);
foreach (GridRegion r in grinfo)
if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
rinfo.Add(r);
}
return rinfo;
}
public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
{
List<GridRegion> rinfo = m_LocalGridService.GetFallbackRegions(scopeID, x, y);
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetFallbackRegions {0} found {1} regions", name, rinfo.Count);
List<GridRegion> grinfo = m_RemoteGridService.GetFallbackRegions(scopeID, x, y);
if (grinfo != null)
{
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetFallbackRegions {0} found {1} regions", name, grinfo.Count);
foreach (GridRegion r in grinfo)
if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
rinfo.Add(r);
}
return rinfo;
}
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
List<GridRegion> rinfo = m_LocalGridService.GetHyperlinks(scopeID);
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetHyperlinks {0} found {1} regions", name, rinfo.Count);
List<GridRegion> grinfo = m_RemoteGridService.GetHyperlinks(scopeID);
if (grinfo != null)
{
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetHyperlinks {0} found {1} regions", name, grinfo.Count);
foreach (GridRegion r in grinfo)
if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
rinfo.Add(r);
}
return rinfo;
}
public int GetRegionFlags(UUID scopeID, UUID regionID)
{ {
int flags = m_LocalGridService.GetRegionFlags(scopeID, regionID); int flags = m_LocalGridService.GetRegionFlags(scopeID, regionID);
if (flags == -1) if (flags == -1)
flags = base.GetRegionFlags(scopeID, regionID); flags = m_RemoteGridService.GetRegionFlags(scopeID, regionID);
return flags; return flags;
} }

View File

@ -93,13 +93,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
} }
// try to fetch from GridServer // try to fetch from GridServer
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(UUID.Zero, mapName, 20); List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
if (regionInfos == null) if (regionInfos == null)
{ {
m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?"); m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?");
// service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region
regionInfos = new List<GridRegion>(); regionInfos = new List<GridRegion>();
GridRegion info = m_scene.GridService.GetRegionByName(UUID.Zero, mapName); GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName);
if (info != null) regionInfos.Add(info); if (info != null) regionInfos.Add(info);
} }

View File

@ -33,6 +33,7 @@ using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Runtime.Remoting.Messaging;
using System.Threading; using System.Threading;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
@ -413,11 +414,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
} }
} }
private int nAsyncRequests = 0;
/// <summary> /// <summary>
/// Processing thread main() loop for doing remote mapitem requests /// Processing thread main() loop for doing remote mapitem requests
/// </summary> /// </summary>
public void process() public void process()
{ {
const int MAX_ASYNC_REQUESTS = 20;
try try
{ {
while (true) while (true)
@ -437,10 +440,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
dorequest = false; dorequest = false;
} }
if (dorequest) if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle))
{ {
OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); while (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break
RequestMapItemsCompleted(response); Thread.Sleep(80);
RequestMapItemsDelegate d = RequestMapItemsAsync;
d.BeginInvoke(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle, RequestMapItemsCompleted, null);
//OSDMap response = RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
//RequestMapItemsCompleted(response);
Interlocked.Increment(ref nAsyncRequests);
} }
} }
@ -469,8 +478,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
/// Sends the mapitem response to the IClientAPI /// Sends the mapitem response to the IClientAPI
/// </summary> /// </summary>
/// <param name="response">The OSDMap Response for the mapitem</param> /// <param name="response">The OSDMap Response for the mapitem</param>
private void RequestMapItemsCompleted(OSDMap response) private void RequestMapItemsCompleted(IAsyncResult iar)
{ {
AsyncResult result = (AsyncResult)iar;
RequestMapItemsDelegate icon = (RequestMapItemsDelegate)result.AsyncDelegate;
OSDMap response = (OSDMap)icon.EndInvoke(iar);
Interlocked.Decrement(ref nAsyncRequests);
if (!response.ContainsKey("requestID"))
return;
UUID requestID = response["requestID"].AsUUID(); UUID requestID = response["requestID"].AsUUID();
if (requestID != UUID.Zero) if (requestID != UUID.Zero)
@ -538,6 +557,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
EnqueueMapItemRequest(st); EnqueueMapItemRequest(st);
} }
private delegate OSDMap RequestMapItemsDelegate(UUID id, uint flags,
uint EstateID, bool godlike, uint itemtype, ulong regionhandle);
/// <summary> /// <summary>
/// Does the actual remote mapitem request /// Does the actual remote mapitem request
/// This should be called from an asynchronous thread /// This should be called from an asynchronous thread
@ -552,9 +573,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
/// <param name="itemtype">passed in from packet</param> /// <param name="itemtype">passed in from packet</param>
/// <param name="regionhandle">Region we're looking up</param> /// <param name="regionhandle">Region we're looking up</param>
/// <returns></returns> /// <returns></returns>
private OSDMap RequestMapItemsAsync(string httpserver, UUID id, uint flags, private OSDMap RequestMapItemsAsync(UUID id, uint flags,
uint EstateID, bool godlike, uint itemtype, ulong regionhandle) uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
{ {
string httpserver = "";
bool blacklisted = false; bool blacklisted = false;
lock (m_blacklistedregions) lock (m_blacklistedregions)
{ {
@ -593,7 +615,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
if (!m_blacklistedregions.ContainsKey(regionhandle)) if (!m_blacklistedregions.ContainsKey(regionhandle))
m_blacklistedregions.Add(regionhandle, Environment.TickCount); m_blacklistedregions.Add(regionhandle, Environment.TickCount);
} }
m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString()); //m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString());
} }
} }
@ -638,7 +660,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
os = mapitemsrequest.GetRequestStream(); os = mapitemsrequest.GetRequestStream();
os.Write(buffer, 0, buffer.Length); //Send it os.Write(buffer, 0, buffer.Length); //Send it
os.Close(); os.Close();
//m_log.DebugFormat("[WORLD MAP]: Getting MapItems from Sim {0}", httpserver); //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from {0}", httpserver);
} }
catch (WebException ex) catch (WebException ex)
{ {
@ -654,15 +676,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
return responseMap; return responseMap;
} }
catch
{
m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver);
responseMap["connect"] = OSD.FromBoolean(false);
return responseMap;
}
string response_mapItems_reply = null; string response_mapItems_reply = null;
{ // get the response { // get the response
StreamReader sr = null;
try try
{ {
WebResponse webResponse = mapitemsrequest.GetResponse(); WebResponse webResponse = mapitemsrequest.GetResponse();
if (webResponse != null) if (webResponse != null)
{ {
StreamReader sr = new StreamReader(webResponse.GetResponseStream()); sr = new StreamReader(webResponse.GetResponseStream());
response_mapItems_reply = sr.ReadToEnd().Trim(); response_mapItems_reply = sr.ReadToEnd().Trim();
} }
else else
@ -683,6 +712,24 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
return responseMap; return responseMap;
} }
catch
{
m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver);
responseMap["connect"] = OSD.FromBoolean(false);
lock (m_blacklistedregions)
{
if (!m_blacklistedregions.ContainsKey(regionhandle))
m_blacklistedregions.Add(regionhandle, Environment.TickCount);
}
return responseMap;
}
finally
{
if (sr != null)
sr.Close();
}
OSD rezResponse = null; OSD rezResponse = null;
try try
{ {
@ -691,14 +738,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
responseMap = (OSDMap)rezResponse; responseMap = (OSDMap)rezResponse;
responseMap["requestID"] = OSD.FromUUID(requestID); responseMap["requestID"] = OSD.FromUUID(requestID);
} }
catch (Exception) catch (Exception ex)
{ {
//m_log.InfoFormat("[OGP]: exception on parse of rez reply {0}", ex.Message); m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message);
responseMap["connect"] = OSD.FromBoolean(false); responseMap["connect"] = OSD.FromBoolean(false);
lock (m_blacklistedregions)
{
if (!m_blacklistedregions.ContainsKey(regionhandle))
m_blacklistedregions.Add(regionhandle, Environment.TickCount);
}
return responseMap; return responseMap;
} }
} }
if (!responseMap.ContainsKey(itemtype.ToString())) // remote sim doesnt have the stated region handle
{
if (!m_blacklistedregions.ContainsKey(regionhandle))
{
m_log.DebugFormat("[WORLD MAP]: Remote sim does not have the stated region. Blacklisting.");
m_blacklistedregions.Add(regionhandle, Environment.TickCount);
}
}
return responseMap; return responseMap;
} }

View File

@ -43,13 +43,14 @@ using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests
{ {
/// <summary> /// <summary>
/// Tests manipulation of scene objects by users. /// Tests derez of scene objects by users.
/// </summary> /// </summary>
/// /// <remarks>
/// This is at a level above the SceneObjectBasicTests, which act on the scene directly. /// This is at a level above the SceneObjectBasicTests, which act on the scene directly.
/// FIXME: These tests are very incomplete - they only test for a few conditions. /// TODO: These tests are very incomplete - they only test for a few conditions.
/// </remarks>
[TestFixture] [TestFixture]
public class SceneObjectUserTests public class SceneObjectDeRezTests
{ {
/// <summary> /// <summary>
/// Test deleting an object from a scene. /// Test deleting an object from a scene.
@ -122,6 +123,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
sogd.InventoryDeQueueAndDelete(); sogd.InventoryDeQueueAndDelete();
// Object should still be in the scene.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
} }

View File

@ -0,0 +1,87 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Region.CoreModules.Avatar.InstantMessage;
using OpenSim.Region.CoreModules.World.Permissions;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests
{
[TestFixture]
public class SceneObjectUserGroupTests
{
/// <summary>
/// Test share with group object functionality
/// </summary>
/// <remarks>This test is not yet fully implemented</remarks>
[Test]
public void TestShareWithGroup()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
TestScene scene = SceneSetupHelpers.SetupScene();
IConfigSource configSource = new IniConfigSource();
IConfig startupConfig = configSource.AddConfig("Startup");
startupConfig.Set("serverside_object_permissions", true);
IConfig groupsConfig = configSource.AddConfig("Groups");
groupsConfig.Set("Enabled", true);
groupsConfig.Set("Module", "GroupsModule");
groupsConfig.Set("DebugEnabled", true);
SceneSetupHelpers.SetupSceneModules(
scene, configSource, new object[]
{ new PermissionsModule(),
new GroupsModule(),
new MockGroupsServicesConnector() });
TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId);
IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>();
groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true);
}
}
}

View File

@ -163,9 +163,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (m_msgTransferModule == null) if (m_msgTransferModule == null)
{ {
m_groupsEnabled = false; m_groupsEnabled = false;
m_log.Error("[GROUPS]: Could not get MessageTransferModule"); m_log.Warn("[GROUPS]: Could not get MessageTransferModule");
Close();
return;
} }
} }
@ -1299,7 +1297,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is local, delivering directly", localClient.Name); if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is local, delivering directly", localClient.Name);
localClient.SendInstantMessage(msg); localClient.SendInstantMessage(msg);
} }
else else if (m_msgTransferModule != null)
{ {
if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is not local, delivering via TransferModule", msgTo); if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is not local, delivering via TransferModule", msgTo);
m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Message Sent: {0}", success?"Succeeded":"Failed"); }); m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Message Sent: {0}", success?"Succeeded":"Failed"); });

View File

@ -27,14 +27,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{ {
interface IGroupsServicesConnector public interface IGroupsServicesConnector
{ {
UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID);
void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);

View File

@ -0,0 +1,65 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Reflection;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
{
/// <summary>
/// Basic groups module tests
/// </summary>
[TestFixture]
public class GroupsModuleTests
{
[Test]
public void TestBasic()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
TestScene scene = SceneSetupHelpers.SetupScene();
IConfigSource configSource = new IniConfigSource();
IConfig config = configSource.AddConfig("Groups");
config.Set("Enabled", true);
config.Set("Module", "GroupsModule");
config.Set("DebugEnabled", true);
SceneSetupHelpers.SetupSceneModules(
scene, configSource, new object[] { new MockGroupsServicesConnector() });
}
}
}

View File

@ -147,7 +147,10 @@ namespace OpenSim.Services.Connectors.Hypergrid
public UUID GetMapImage(UUID regionID, string imageURL, string storagePath) public UUID GetMapImage(UUID regionID, string imageURL, string storagePath)
{ {
if (m_AssetService == null) if (m_AssetService == null)
{
m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: No AssetService defined. Map tile not retrieved.");
return m_HGMapImage; return m_HGMapImage;
}
UUID mapTile = m_HGMapImage; UUID mapTile = m_HGMapImage;
string filename = string.Empty; string filename = string.Empty;
@ -167,8 +170,6 @@ namespace OpenSim.Services.Connectors.Hypergrid
// !!! for now // !!! for now
//info.RegionSettings.TerrainImageID = ass.FullID; //info.RegionSettings.TerrainImageID = ass.FullID;
ass.Temporary = true;
ass.Local = true;
ass.Data = imageData; ass.Data = imageData;
m_AssetService.Store(ass); m_AssetService.Store(ass);

View File

@ -0,0 +1,237 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Mono.Addins;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
namespace OpenSim.Tests.Common.Mock
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class MockGroupsServicesConnector : ISharedRegionModule, IGroupsServicesConnector
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string Name
{
get { return "MockGroupsServicesConnector"; }
}
public Type ReplaceableInterface
{
get { return null; }
}
public void Initialise(IConfigSource config)
{
}
public void Close()
{
}
public void AddRegion(Scene scene)
{
m_log.DebugFormat("[MOCK GROUPS SERVICES CONNECTOR]: Adding to region {0}", scene.RegionInfo.RegionName);
scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
}
public void RemoveRegion(Scene scene)
{
}
public void RegionLoaded(Scene scene)
{
}
public void PostInitialise()
{
}
public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID,
int membershipFee, bool openEnrollment, bool allowPublish,
bool maturePublish, UUID founderID)
{
return UUID.Zero;
}
public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList,
UUID insigniaID, int membershipFee, bool openEnrollment,
bool allowPublish, bool maturePublish)
{
}
public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
string title, ulong powers)
{
}
public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID)
{
}
public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
string title, ulong powers)
{
}
public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName)
{
return null;
}
public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID)
{
return default(GroupProfileData);
}
public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
{
}
public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
{
}
public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile)
{
}
public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID)
{
}
public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
{
return null;
}
public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
{
}
public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
{
}
public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
{
}
public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
{
}
public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
{
}
public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search)
{
return null;
}
public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID)
{
return null;
}
public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID)
{
return null;
}
public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID)
{
return new List<GroupMembershipData>();
}
public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID)
{
return null;
}
public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID)
{
return null;
}
public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID)
{
return null;
}
public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
{
return null;
}
public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID)
{
return null;
}
public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)
{
return null;
}
public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
{
}
public void ResetAgentGroupChatSessions(UUID agentID)
{
}
public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID)
{
return false;
}
public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID)
{
return false;
}
public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID)
{
}
public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID)
{
}
}
}

View File

@ -424,10 +424,13 @@ namespace OpenSim.Tests.Common.Setup
foreach (IRegionModuleBase module in newModules) foreach (IRegionModuleBase module in newModules)
{ {
module.AddRegion(scene); module.AddRegion(scene);
module.RegionLoaded(scene);
scene.AddRegionModule(module.Name, module); scene.AddRegionModule(module.Name, module);
} }
// RegionLoaded is fired after all modules have been appropriately added to all scenes
foreach (IRegionModuleBase module in newModules)
module.RegionLoaded(scene);
scene.SetModuleInterfaces(); scene.SetModuleInterfaces();
} }

Binary file not shown.

View File

@ -2765,6 +2765,7 @@
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Data"/> <Reference name="System.Data"/>
<Reference name="log4net" path="../../../bin/"/> <Reference name="log4net" path="../../../bin/"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<Reference name="Nini" path="../../../bin/"/> <Reference name="Nini" path="../../../bin/"/>
<Reference name="nunit.framework" path="../../../bin/"/> <Reference name="nunit.framework" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/> <Reference name="OpenMetaverse" path="../../../bin/"/>
@ -2779,6 +2780,7 @@
<Reference name="OpenSim.Server.Base"/> <Reference name="OpenSim.Server.Base"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.OptionalModules"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Files> <Files>
@ -3006,6 +3008,62 @@
</Files> </Files>
</Project> </Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.OptionalModules.Tests" path="OpenSim/Region/OptionalModules" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Xml"/>
<Reference name="System.Drawing"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Serialization"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="OpenSim.Services.Interfaces"/>
<!-- Unit tests -->
<Reference name="OpenSim.Tests.Common"/>
<Reference name="Nini" path="../../../bin/"/>
<Reference name="nunit.framework" path="../../../bin/"/>
<!-- For scripting in funny languages by default -->
<Reference name="XMLRPC" path="../../../bin/"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="Nini" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
<Reference name="DotNetOpenMail" path="../../../bin/"/>
<!--
TODO: this is kind of lame, we basically build a duplicate
assembly but with tests added in, just so that we don't
need to hard code in a bunch of Test directories here. If
pattern="Tests/*.cs" worked, we wouldn't need this.
-->
<Files>
<!-- SADLY the way this works means you need to keep adding these paths -->
<Match path="Avatar/XmlRpcGroups/Tests" pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.Framework.Tests" path="OpenSim/Region/Framework" type="Library"> <Project frameworkVersion="v3_5" name="OpenSim.Region.Framework.Tests" path="OpenSim/Region/Framework" type="Library">
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>
@ -3034,6 +3092,7 @@
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.OptionalModules"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="OpenSim.Services.Interfaces"/> <Reference name="OpenSim.Services.Interfaces"/>