Merge branch '0.6.9-post-fixes' into careminster

avinationmerge
Melanie 2010-07-17 03:09:27 +01:00
commit 6f591376dd
24 changed files with 669 additions and 225 deletions

View File

@ -95,11 +95,6 @@
</exec> </exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" /> <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.communications.tests">
<arg value="./bin/OpenSim.Framework.Communications.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.communications.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.servers.tests"> <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.servers.tests">
<arg value="./bin/OpenSim.Framework.Servers.Tests.dll" /> <arg value="./bin/OpenSim.Framework.Servers.Tests.dll" />
</exec> </exec>
@ -160,17 +155,6 @@
<arg value="--export-html=./cov/OpenSim.Framework.Servers ./cov/OpenSim.Framework.Servers.cov" /> <arg value="--export-html=./cov/OpenSim.Framework.Servers ./cov/OpenSim.Framework.Servers.cov" />
</exec> </exec>
<exec program="mono">
<arg value="--debug" />
<arg value="--profile=monocov:outfile=./cov/OpenSim.Framework.Communications.cov,+[OpenSim.Framework.Communications]" />
<arg value="/usr/lib/nunit/nunit-console.exe" />
<arg value="./bin/OpenSim.Framework.Communications.Tests.dll" />
</exec>
<delete dir="./cov/OpenSim.Framework.Communications" />
<exec program="monocov">
<arg value="--export-html=./cov/OpenSim.Framework.Servers ./cov/OpenSim.Framework.Communications.cov" />
</exec>
<!-- <!--
<exec program="mono"> <exec program="mono">
<arg value="&#45;&#45;debug" /> <arg value="&#45;&#45;debug" />
@ -281,11 +265,6 @@
<arg value="-xml=test-results/OpenSim.Framework.Tests.dll-Results.xml" /> <arg value="-xml=test-results/OpenSim.Framework.Tests.dll-Results.xml" />
</exec> </exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.communications.tests">
<arg value="./bin/OpenSim.Framework.Communications.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Framework.Communications.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.serialization.tests"> <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.serialization.tests">
<arg value="./bin/OpenSim.Framework.Serialization.Tests.dll" /> <arg value="./bin/OpenSim.Framework.Serialization.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Framework.Serialization.Tests.dll-Results.xml" /> <arg value="-xml=test-results/OpenSim.Framework.Serialization.Tests.dll-Results.xml" />
@ -355,7 +334,6 @@
<!-- <test> --> <!-- <test> -->
<!-- <assemblies> --> <!-- <assemblies> -->
<!-- <include name="./bin/OpenSim.Framework.Tests.dll" /> --> <!-- <include name="./bin/OpenSim.Framework.Tests.dll" /> -->
<!-- <include name="./bin/OpenSim.Framework.Communications.Tests.dll"/> -->
<!-- <include name="./bin/OpenSim.Framework.Servers.Tests.dll" /> --> <!-- <include name="./bin/OpenSim.Framework.Servers.Tests.dll" /> -->
<!-- <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" /> -->

View File

@ -2251,5 +2251,15 @@ namespace OpenSim.Data.SQLiteLegacy
} }
} }
public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
{
//This connector doesn't support the windlight module yet
//Return default LL windlight settings
return new RegionMeta7WindlightData();
}
public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
{
//This connector doesn't support the windlight module yet
}
} }
} }

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -164,9 +164,9 @@ namespace OpenSim.Framework.Communications.Clients
} }
} }
} }
catch (WebException ex) catch (Exception ex)
{ {
m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateChildAgentCall {0}", ex.Message); m_log.DebugFormat("[REST COMMS]: exception on reply of DoCreateChildAgentCall {0}", ex.Message);
// ignore, really // ignore, really
} }
finally finally
@ -176,7 +176,6 @@ namespace OpenSim.Framework.Communications.Clients
} }
return true; return true;
} }
public bool DoChildAgentUpdateCall(GridRegion region, IAgentData cAgentData) public bool DoChildAgentUpdateCall(GridRegion region, IAgentData cAgentData)

View File

@ -98,6 +98,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary> /// </summary>
public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector
{ {
/// <value>
/// Debug packet level. At the moment, only 255 does anything (prints out all in and out packets).
/// </value>
protected int m_debugPacketLevel = 0;
#region Events #region Events
public event GenericMessage OnGenericMessage; public event GenericMessage OnGenericMessage;
@ -365,6 +370,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </value> /// </value>
protected HashSet<uint> m_killRecord; protected HashSet<uint> m_killRecord;
// protected HashSet<uint> m_attachmentsQueued;
// protected HashSet<uint> m_attachmentsSent;
private int m_moneyBalance; private int m_moneyBalance;
private int m_animationSequenceNumber = 1; private int m_animationSequenceNumber = 1;
private bool m_SendLogoutPacketWhenClosing = true; private bool m_SendLogoutPacketWhenClosing = true;
@ -456,6 +464,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_primFullUpdates = new PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock>(m_scene.Entities.Count); m_primFullUpdates = new PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock>(m_scene.Entities.Count);
m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
m_killRecord = new HashSet<uint>(); m_killRecord = new HashSet<uint>();
// m_attachmentsQueued = new HashSet<uint>();
// m_attachmentsSent = new HashSet<uint>();
m_assetService = m_scene.RequestModuleInterface<IAssetService>(); m_assetService = m_scene.RequestModuleInterface<IAssetService>();
m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>(); m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
@ -485,6 +495,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SetDebugPacketLevel(int newDebug) public void SetDebugPacketLevel(int newDebug)
{ {
m_debugPacketLevel = newDebug;
} }
#region Client Methods #region Client Methods
@ -669,8 +680,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void ProcessSpecificPacketAsync(object state) public void ProcessSpecificPacketAsync(object state)
{ {
AsyncPacketProcess packetObject = (AsyncPacketProcess)state; AsyncPacketProcess packetObject = (AsyncPacketProcess)state;
packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack); packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack);
} }
#endregion Packet Handling #endregion Packet Handling
@ -3397,6 +3407,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data);
OutPacket(objupdate, ThrottleOutPacketType.Task); OutPacket(objupdate, ThrottleOutPacketType.Task);
// We need to record the avatar local id since the root prim of an attachment points to this.
// m_attachmentsSent.Add(data.AvatarLocalID);
} }
/// <summary> /// <summary>
@ -3499,8 +3512,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// if (text.IndexOf("\n") >= 0) // if (text.IndexOf("\n") >= 0)
// text = text.Remove(text.IndexOf("\n")); // text = text.Remove(text.IndexOf("\n"));
// m_log.DebugFormat( // m_log.DebugFormat(
// "[CLIENT]: Placing request to send full info about prim {0} text {1} to client {2}", // "[CLIENT]: Queueing send full info about prim {0}, attachment {1}, text {2} to client {3}",
// data.localID, text, Name); // data.localID, data.attachment, text, Name);
if (data.priority == double.NaN) if (data.priority == double.NaN)
{ {
@ -3518,6 +3531,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return; return;
ObjectUpdatePacket.ObjectDataBlock objectData = CreatePrimUpdateBlock(data); ObjectUpdatePacket.ObjectDataBlock objectData = CreatePrimUpdateBlock(data);
// if (data.attachment)
// m_attachmentsQueued.Add(data.localID);
lock (m_primFullUpdates.SyncRoot) lock (m_primFullUpdates.SyncRoot)
m_primFullUpdates.Enqueue(data.priority, objectData, data.localID); m_primFullUpdates.Enqueue(data.priority, objectData, data.localID);
@ -3544,15 +3560,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ObjectUpdatePacket.ObjectDataBlock block = m_primFullUpdates.Dequeue(); ObjectUpdatePacket.ObjectDataBlock block = m_primFullUpdates.Dequeue();
if (!m_killRecord.Contains(block.ID)) if (!m_killRecord.Contains(block.ID))
{ {
// if (m_attachmentsQueued.Contains(block.ID))
// {
// string text = Util.FieldToString(block.Text);
// if (text.IndexOf("\n") >= 0)
// text = text.Remove(text.IndexOf("\n"));
//
// if (m_attachmentsSent.Contains(block.ParentID))
// {
// m_log.DebugFormat(
// "[CLIENT]: Sending full info about attached prim {0} text {1}",
// block.ID, text);
//
// m_fullUpdateDataBlocksBuilder.Add(block);
//
// m_attachmentsSent.Add(block.ID);
// }
// else
// {
// m_log.DebugFormat(
// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet",
// block.ID, text, block.ParentID);
//
// lock (m_primFullUpdates.SyncRoot)
// m_primFullUpdates.Enqueue(double.MaxValue, block, block.ID);
// }
// }
// else
// {
m_fullUpdateDataBlocksBuilder.Add(block); m_fullUpdateDataBlocksBuilder.Add(block);
// }
// string text = Util.FieldToString(outPacket.ObjectData[i].Text);
// if (text.IndexOf("\n") >= 0)
// text = text.Remove(text.IndexOf("\n"));
// m_log.DebugFormat(
// "[CLIENT]: Sending full info about prim {0} text {1} to client {2}",
// outPacket.ObjectData[i].ID, text, Name);
} }
// else // else
// { // {
@ -4504,6 +4542,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SendPrimitiveData data) protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SendPrimitiveData data)
{ {
// if (data.attachment)
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Creating prim update block for {0}, parent {1}, priority {2}",
// data.localID, data.parentID, data.priority);
byte[] objectData = new byte[60]; byte[] objectData = new byte[60];
data.pos.ToBytes(objectData, 0); data.pos.ToBytes(objectData, 0);
data.vel.ToBytes(objectData, 12); data.vel.ToBytes(objectData, 12);
@ -7053,32 +7096,89 @@ namespace OpenSim.Region.ClientStack.LindenUDP
taskID = new UUID(transfer.TransferInfo.Params, 48); taskID = new UUID(transfer.TransferInfo.Params, 48);
UUID itemID = new UUID(transfer.TransferInfo.Params, 64); UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
UUID requestID = new UUID(transfer.TransferInfo.Params, 80); UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
// m_log.DebugFormat(
// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}",
// requestID, itemID, taskID, Name);
if (!(((Scene)m_scene).Permissions.BypassPermissions())) if (!(((Scene)m_scene).Permissions.BypassPermissions()))
{ {
if (taskID != UUID.Zero) // Prim if (taskID != UUID.Zero) // Prim
{ {
SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
if (part == null) if (part == null)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist",
Name, requestID, itemID, taskID);
return true; return true;
}
if (part.OwnerID != AgentId) TaskInventoryItem tii = part.Inventory.GetInventoryItem(itemID);
return true; if (tii == null)
{
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) m_log.WarnFormat(
return true; "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
Name, requestID, itemID, taskID);
TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID);
if (ti == null)
return true;
if (ti.OwnerID != AgentId)
return true;
if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
return true;
if (ti.AssetID != requestID)
return true; return true;
}
if (tii.Type == (int)AssetType.LSLText)
{
if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId))
return true;
}
else if (tii.Type == (int)AssetType.Notecard)
{
if (!((Scene)m_scene).Permissions.CanEditNotecard(itemID, taskID, AgentId))
return true;
}
else
{
// TODO: Change this code to allow items other than notecards and scripts to be successfully
// shared with group. In fact, all this permissions checking should move to an IPermissionsModule
if (part.OwnerID != AgentId)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}",
Name, requestID, itemID, taskID, part.OwnerID);
return true;
}
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
Name, requestID, itemID, taskID);
return true;
}
if (tii.OwnerID != AgentId)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
Name, requestID, itemID, taskID, tii.OwnerID);
return true;
}
if ((
tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
!= ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
Name, requestID, itemID, taskID);
return true;
}
if (tii.AssetID != requestID)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}",
Name, requestID, itemID, taskID, tii.AssetID);
return true;
}
}
} }
else // Agent else // Agent
{ {
@ -7114,7 +7214,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
if (assetRequestItem.AssetID != requestID) if (assetRequestItem.AssetID != requestID)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
Name, requestID, itemID, assetRequestItem.AssetID);
return true; return true;
}
} }
} }
} }
@ -7661,12 +7766,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask; newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask;
newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask; newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask;
newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask; newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask;
// Unused? Clicking share with group sets GroupPermissions instead, so perhaps this is something
// different
//newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned; //newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned;
newTaskItem.Type = updatetask.InventoryData.Type; newTaskItem.Type = updatetask.InventoryData.Type;
newTaskItem.InvType = updatetask.InventoryData.InvType; newTaskItem.InvType = updatetask.InventoryData.InvType;
newTaskItem.Flags = updatetask.InventoryData.Flags; newTaskItem.Flags = updatetask.InventoryData.Flags;
//newTaskItem.SaleType=updatetask.InventoryData.SaleType; //newTaskItem.SaleType=updatetask.InventoryData.SaleType;
//newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;; //newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;
newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name); newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name);
newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description); newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description);
newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate; newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate;
@ -7674,7 +7782,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
newTaskItem, updatetask.UpdateData.LocalID); newTaskItem, updatetask.UpdateData.LocalID);
} }
} }
} }
return true; return true;
} }
@ -10977,7 +11085,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
LLUDPServer.LogPacketHeader(false, m_circuitCode, 0, packet.Type, (ushort)packet.Length); LLUDPServer.LogPacketHeader(false, m_circuitCode, 0, packet.Type, (ushort)packet.Length);
#endregion BinaryStats #endregion BinaryStats
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true); OutPacket(packet, throttlePacketType, true);
} }
/// <summary> /// <summary>
@ -10990,6 +11098,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// handles splitting manually</param> /// handles splitting manually</param>
protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting)
{ {
if (m_debugPacketLevel >= 255)
m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type);
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting);
} }
@ -11061,10 +11172,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="Pack">OpenMetaverse.packet</param> /// <param name="Pack">OpenMetaverse.packet</param>
public void ProcessInPacket(Packet Pack) public void ProcessInPacket(Packet Pack)
{ {
// m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack); if (m_debugPacketLevel >= 255)
m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type);
if (!ProcessPacketMethod(Pack)) if (!ProcessPacketMethod(Pack))
m_log.Warn("[CLIENT]: unhandled packet " + Pack); m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type);
PacketPool.Instance.ReturnPacket(Pack); PacketPool.Instance.ReturnPacket(Pack);
} }
@ -11307,8 +11419,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// } // }
} }
//check to see if asset is in local cache, if not we need to request it from asset server. // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
//m_log.Debug("asset request " + requestID);
m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
@ -11589,6 +11700,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public PacketMethod method; public PacketMethod method;
public bool Async; public bool Async;
} }
public class AsyncPacketProcess public class AsyncPacketProcess
{ {
public bool result = false; public bool result = false;
@ -11631,4 +11743,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(packet, ThrottleOutPacketType.Task); OutPacket(packet, ThrottleOutPacketType.Task);
} }
} }
} }

View File

@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
{ {
if (s.RegionInfo.RegionHandle == regionHandle) if (s.RegionInfo.RegionHandle == regionHandle)
{ {
//m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); // m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject");
if (isLocalCall) if (isLocalCall)
{ {
// We need to make a local copy of the object // We need to make a local copy of the object

View File

@ -145,7 +145,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>();
private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>();
private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>();
private IFriendsModule m_friendsModule = null; private IFriendsModule m_friendsModule;
private IGroupsModule m_groupsModule;
#endregion #endregion
@ -369,9 +370,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
if (m_friendsModule == null) if (m_friendsModule == null)
m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work"); m_log.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work");
else
m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled"); m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
if (m_groupsModule == null)
m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");
} }
public void Close() public void Close()
@ -406,15 +410,34 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// with the powers requested (powers = 0 for no powers check) // with the powers requested (powers = 0 for no powers check)
protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
{ {
//DateTime t1 = DateTime.Now;
bool result = false;
ScenePresence sp = m_scene.GetScenePresence(userID); ScenePresence sp = m_scene.GetScenePresence(userID);
if (sp != null) if (sp != null)
{ {
IClientAPI client = sp.ControllingClient; IClientAPI client = sp.ControllingClient;
return ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) && result = ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) &&
((powers == 0) || ((client.ActiveGroupPowers & powers) == powers))); ((powers == 0) || ((client.ActiveGroupPowers & powers) == powers)));
} }
return false;
/*
if (null != m_groupsModule)
{
GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID);
if (gmd != null)
{
if (((gmd.GroupPowers != 0) && powers == 0) || (gmd.GroupPowers & powers) == powers)
result = true;
}
}
*/
//m_log.DebugFormat("[PERMISSIONS]: Group member check took {0}", (DateTime.Now - t1).TotalMilliseconds);
return result;
} }
/// <summary> /// <summary>
@ -704,8 +727,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
permission = false; permission = false;
} }
// m_log.DebugFormat(
// "[PERMISSIONS]: group.GroupID = {0}, part.GroupMask = {1}, isGroupMember = {2} for {3}",
// group.GroupID,
// m_scene.GetSceneObjectPart(objId).GroupMask,
// IsGroupMember(group.GroupID, currentUser, 0),
// currentUser);
// Group members should be able to edit group objects // Group members should be able to edit group objects
if ((group.GroupID != UUID.Zero) && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0) && IsGroupMember(group.GroupID, currentUser, 0)) if ((group.GroupID != UUID.Zero)
&& ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0)
&& IsGroupMember(group.GroupID, currentUser, 0))
{ {
// Return immediately, so that the administrator can shares group objects // Return immediately, so that the administrator can shares group objects
return true; return true;
@ -940,7 +972,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue; if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericObjectPermission(editorID, objectID, false); return GenericObjectPermission(editorID, objectID, false);
} }
@ -1047,7 +1078,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) if ((part.GroupMask & (uint)PermissionMask.Modify) == 0)
return false; return false;
} else { }
else
{
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return false; return false;
} }
@ -1063,7 +1096,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false; return false;
if (!IsGroupMember(ti.GroupID, user, 0)) if (!IsGroupMember(ti.GroupID, user, 0))
return false; return false;
} }
// Require full perms // Require full perms
@ -1470,14 +1503,16 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (part.OwnerID != user) if (part.OwnerID != user)
{ {
if (part.GroupID == UUID.Zero) if (part.GroupID == UUID.Zero)
return false; return false;
if (!IsGroupMember(part.GroupID, user, 0)) if (!IsGroupMember(part.GroupID, user, 0))
return false; return false;
if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) if ((part.GroupMask & (uint)PermissionMask.Modify) == 0)
return false; return false;
} else { }
else
{
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return false; return false;
} }
@ -1732,7 +1767,69 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericObjectPermission(agentID, prim, false); return GenericObjectPermission(agentID, prim, false);
} }
private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) { private bool CanUseObjectReturn(ILandObject parcel, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
long powers = 0;
if (parcel.LandData.GroupID != UUID.Zero)
client.GetGroupPowers(parcel.LandData.GroupID);
switch (type)
{
case (uint)ObjectReturnType.Owner:
// Don't let group members return owner's objects, ever
//
if (parcel.LandData.IsGroupOwned)
{
if ((powers & (long)GroupPowers.ReturnGroupOwned) != 0)
return true;
}
else
{
if (parcel.LandData.OwnerID != client.AgentId)
return false;
}
return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupOwned);
case (uint)ObjectReturnType.Group:
if (parcel.LandData.OwnerID != client.AgentId)
{
// If permissionis granted through a group...
//
if ((powers & (long)GroupPowers.ReturnGroupSet) != 0)
{
foreach (SceneObjectGroup g in new List<SceneObjectGroup>(retlist))
{
// check for and remove group owned objects unless
// the user also has permissions to return those
//
if (g.OwnerID == g.GroupID &&
((powers & (long)GroupPowers.ReturnGroupOwned) == 0))
{
retlist.Remove(g);
}
}
// And allow the operation
//
return true;
}
}
return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupSet);
case (uint)ObjectReturnType.Other:
if ((powers & (long)GroupPowers.ReturnNonGroup) != 0)
return true;
return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnNonGroup);
case (uint)ObjectReturnType.List:
break;
}
return GenericParcelOwnerPermission(client.AgentId, parcel, 0);
// Is it correct to be less restrictive for lists of objects to be returned?
}
private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene)
{
//m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType);
switch (scriptType) { switch (scriptType) {
case 0: case 0:

View File

@ -1225,6 +1225,7 @@ namespace OpenSim.Region.Framework.Scenes
item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
} }
// If we've found the item in the user's inventory or in the library
if (item != null) if (item != null)
{ {
part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID);
@ -2458,6 +2459,8 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
// m_log.DebugFormat("[SCENE INVENTORY]: {0} {1} IsAttachment={2}", att.Name, att.LocalId, att.IsAttachment);
// Console.WriteLine("HERE X");
ScenePresence presence; ScenePresence presence;
if (TryGetAvatar(remoteClient.AgentId, out presence)) if (TryGetAvatar(remoteClient.AgentId, out presence))
{ {
@ -2465,9 +2468,12 @@ namespace OpenSim.Region.Framework.Scenes
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item); item = InventoryService.GetItem(item);
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
// Console.WriteLine("HERE Y");
if (m_AvatarFactory != null) if (m_AvatarFactory != null)
m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
// Console.WriteLine("HERE Z");
} }
} }

View File

@ -116,6 +116,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
public void RequestPrim(uint primLocalID, IClientAPI remoteClient) public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
{ {
// m_log.DebugFormat("[SCENE]: {0} requested full update for {1}", remoteClient.Name, primLocalID);
List<EntityBase> EntityList = GetEntities(); List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList) foreach (EntityBase ent in EntityList)

View File

@ -1874,6 +1874,28 @@ namespace OpenSim.Region.Framework.Scenes
return sceneObject; return sceneObject;
} }
/// <summary>
/// Add an object into the scene that has come from storage
/// </summary>
///
/// <param name="sceneObject"></param>
/// <param name="attachToBackup">
/// If true, changes to the object will be reflected in its persisted data
/// If false, the persisted data will not be changed even if the object in the scene is changed
/// </param>
/// <param name="alreadyPersisted">
/// If true, we won't persist this object until it changes
/// If false, we'll persist this object immediately
/// </param>
/// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns>
public bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
{
return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates);
}
/// <summary> /// <summary>
/// Add an object into the scene that has come from storage /// Add an object into the scene that has come from storage
/// </summary> /// </summary>
@ -1893,7 +1915,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool AddRestoredSceneObject( public bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
{ {
return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted); return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true);
} }
/// <summary> /// <summary>
@ -2506,7 +2528,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns> /// <returns></returns>
public bool IncomingCreateObject(ISceneObject sog) public bool IncomingCreateObject(ISceneObject sog)
{ {
//m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); // m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
SceneObjectGroup newObject; SceneObjectGroup newObject;
try try
{ {
@ -2578,10 +2600,12 @@ namespace OpenSim.Region.Framework.Scenes
if (sceneObject.IsAttachmentCheckFull()) // Attachment if (sceneObject.IsAttachmentCheckFull()) // Attachment
{ {
// m_log.DebugFormat("[SCENE]: Adding attachment {0} {1}", sceneObject.Name, sceneObject.LocalId);
sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
sceneObject.RootPart.AddFlag(PrimFlags.Phantom); sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
AddRestoredSceneObject(sceneObject, false, false); AddRestoredSceneObject(sceneObject, false, false, false);
// Handle attachment special case // Handle attachment special case
SceneObjectPart RootPrim = sceneObject.RootPart; SceneObjectPart RootPrim = sceneObject.RootPart;
@ -2589,6 +2613,8 @@ namespace OpenSim.Region.Framework.Scenes
// Fix up attachment Parent Local ID // Fix up attachment Parent Local ID
ScenePresence sp = GetScenePresence(sceneObject.OwnerID); ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
// Console.WriteLine("AAAA");
//uint parentLocalID = 0; //uint parentLocalID = 0;
if (sp != null) if (sp != null)
{ {
@ -2607,20 +2633,25 @@ namespace OpenSim.Region.Framework.Scenes
//grp.SetFromAssetID(grp.RootPart.LastOwnerID); //grp.SetFromAssetID(grp.RootPart.LastOwnerID);
m_log.DebugFormat( m_log.DebugFormat(
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
AttachObject( AttachObject(
sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
grp.SendGroupFullUpdate(); //grp.SendGroupFullUpdate();
} }
else else
{ {
RootPrim.RemFlag(PrimFlags.TemporaryOnRez); RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
RootPrim.AddFlag(PrimFlags.TemporaryOnRez); RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
} }
// Console.WriteLine("BBBB");
} }
else else
{ {
// m_log.DebugFormat("[SCENE]: Adding ordinary object {0} {1}", sceneObject.Name, sceneObject.LocalId);
AddRestoredSceneObject(sceneObject, true, false); AddRestoredSceneObject(sceneObject, true, false);
if (!Permissions.CanObjectEntry(sceneObject.UUID, if (!Permissions.CanObjectEntry(sceneObject.UUID,

View File

@ -1410,7 +1410,9 @@ namespace OpenSim.Region.Framework.Scenes
// now we have a child agent in this region. Request all interesting data about other (root) agents // now we have a child agent in this region. Request all interesting data about other (root) agents
agent.SendInitialFullUpdateToAllClients(); agent.SendInitialFullUpdateToAllClients();
// Console.WriteLine("SCS 1");
agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true); agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true);
// Console.WriteLine("SCS 2");
// m_scene.SendKillObject(m_localId); // m_scene.SendKillObject(m_localId);

View File

@ -216,11 +216,15 @@ namespace OpenSim.Region.Framework.Scenes
/// If true, we won't persist this object until it changes /// If true, we won't persist this object until it changes
/// If false, we'll persist this object immediately /// If false, we'll persist this object immediately
/// </param> /// </param>
/// <param name="sendClientUpdate">
/// If true, we send updates to the client to tell it about this object
/// If false, we leave it up to the caller to do this
/// </param>
/// <returns> /// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene /// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns> /// </returns>
protected internal bool AddRestoredSceneObject( protected internal bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
{ {
// KF: Check for out-of-region, move inside and make static. // KF: Check for out-of-region, move inside and make static.
Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X,
@ -252,8 +256,29 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.HasGroupChanged = true; sceneObject.HasGroupChanged = true;
} }
return AddSceneObject(sceneObject, attachToBackup, true); return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
} }
// /// <summary>
// /// Add an object into the scene that has come from storage
// /// </summary>
// /// <param name="sceneObject"></param>
// /// <param name="attachToBackup">
// /// If true, changes to the object will be reflected in its persisted data
// /// If false, the persisted data will not be changed even if the object in the scene is changed
// /// </param>
// /// <param name="alreadyPersisted">
// /// If true, we won't persist this object until it changes
// /// If false, we'll persist this object immediately
// /// </param>
// /// <returns>
// /// true if the object was added, false if an object with the same uuid was already in the scene
// /// </returns>
// protected internal bool AddRestoredSceneObject(
// SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
// {
// AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true);
// }
/// <summary> /// <summary>
/// Add a newly created object to the scene. This will both update the scene, and send information about the /// Add a newly created object to the scene. This will both update the scene, and send information about the
@ -647,11 +672,13 @@ namespace OpenSim.Region.Framework.Scenes
protected internal bool AttachObject( protected internal bool AttachObject(
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
{ {
// Console.WriteLine("HERE A");
SceneObjectGroup group = GetGroupByPrim(objectLocalID); SceneObjectGroup group = GetGroupByPrim(objectLocalID);
if (group != null) if (group != null)
{ {
if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
{ {
// Console.WriteLine("HERE -1");
// If the attachment point isn't the same as the one previously used // If the attachment point isn't the same as the one previously used
// set it's offset position = 0 so that it appears on the attachment point // set it's offset position = 0 so that it appears on the attachment point
// and not in a weird location somewhere unknown. // and not in a weird location somewhere unknown.
@ -690,9 +717,12 @@ namespace OpenSim.Region.Framework.Scenes
itemId = group.GetFromItemID(); itemId = group.GetFromItemID();
} }
// Console.WriteLine("HERE 0");
m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group);
// Console.WriteLine("HERE 1");
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
// Console.WriteLine("HERE 2");
// In case it is later dropped again, don't let // In case it is later dropped again, don't let
// it get cleaned up // it get cleaned up
// //

View File

@ -422,7 +422,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!scenePresence.IsChildAgent) if (!scenePresence.IsChildAgent)
{ {
m_log.ErrorFormat("Packet debug for {0} {1} set to {2}", m_log.DebugFormat("Packet debug for {0} {1} set to {2}",
scenePresence.Firstname, scenePresence.Firstname,
scenePresence.Lastname, scenePresence.Lastname,
newDebug); newDebug);

View File

@ -171,7 +171,9 @@ namespace OpenSim.Region.Framework.Scenes
item.NextPermissions; item.NextPermissions;
taskItem.NextPermissions = item.NextPermissions; taskItem.NextPermissions = item.NextPermissions;
taskItem.CurrentPermissions |= 8; taskItem.CurrentPermissions |= 8;
} else { }
else
{
taskItem.BasePermissions = item.BasePermissions; taskItem.BasePermissions = item.BasePermissions;
taskItem.CurrentPermissions = item.CurrentPermissions; taskItem.CurrentPermissions = item.CurrentPermissions;
taskItem.CurrentPermissions |= 8; taskItem.CurrentPermissions |= 8;

View File

@ -1651,6 +1651,10 @@ namespace OpenSim.Region.Framework.Scenes
public void SendFullUpdateToClient(IClientAPI remoteClient) public void SendFullUpdateToClient(IClientAPI remoteClient)
{ {
// if (IsAttachment)
// m_log.DebugFormat(
// "[SOG]: Sending full update to client {0} for {1} {2}", remoteClient.Name, Name, LocalId);
SendPartFullUpdate(remoteClient, RootPart, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID)); SendPartFullUpdate(remoteClient, RootPart, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID));
lockPartsForRead(true); lockPartsForRead(true);
@ -1673,8 +1677,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="part"></param> /// <param name="part"></param>
internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags)
{ {
// m_log.DebugFormat( // if (IsAttachment)
// "[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); // m_log.DebugFormat(
// "[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
if (m_rootPart.UUID == part.UUID) if (m_rootPart.UUID == part.UUID)
{ {
@ -2186,7 +2191,8 @@ namespace OpenSim.Region.Framework.Scenes
public void ScheduleFullUpdateToAvatar(ScenePresence presence) public void ScheduleFullUpdateToAvatar(ScenePresence presence)
{ {
// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1} just to avatar {2}", Name, UUID, presence.Name); // if (IsAttachment)
// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1} just to avatar {2}", Name, UUID, presence.Name);
RootPart.AddFullUpdateToAvatar(presence); RootPart.AddFullUpdateToAvatar(presence);
@ -2222,7 +2228,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ScheduleGroupForFullUpdate() public void ScheduleGroupForFullUpdate()
{ {
// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, UUID); // if (IsAttachment)
// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId);
checkAtTargets(); checkAtTargets();
RootPart.ScheduleFullUpdate(); RootPart.ScheduleFullUpdate();
@ -2265,7 +2272,7 @@ namespace OpenSim.Region.Framework.Scenes
if (IsDeleted) if (IsDeleted)
return; return;
// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID); // m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, LocalId);
RootPart.SendFullUpdateToAllClients(); RootPart.SendFullUpdateToAllClients();

View File

@ -1270,16 +1270,17 @@ namespace OpenSim.Region.Framework.Scenes
/// Tell all scene presences that they should send updates for this part to their clients /// Tell all scene presences that they should send updates for this part to their clients
/// </summary> /// </summary>
public void AddFullUpdateToAllAvatars() public void AddFullUpdateToAllAvatars()
{ {
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Length; i++)
{ AddFullUpdateToAvatar(avatars[i]);
avatars[i].SceneViewer.QueuePartForUpdate(this);
}
} }
public void AddFullUpdateToAvatar(ScenePresence presence) public void AddFullUpdateToAvatar(ScenePresence presence)
{ {
// if (IsAttachment)
// m_log.DebugFormat("AddFullUpdateToAllAvatar() {0} for {1} {2}", presence.Name, Name, LocalId);
presence.SceneViewer.QueuePartForUpdate(this); presence.SceneViewer.QueuePartForUpdate(this);
} }
@ -1298,13 +1299,14 @@ namespace OpenSim.Region.Framework.Scenes
{ {
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Length; i++)
{ AddTerseUpdateToAvatar(avatars[i]);
avatars[i].SceneViewer.QueuePartForUpdate(this);
}
} }
public void AddTerseUpdateToAvatar(ScenePresence presence) public void AddTerseUpdateToAvatar(ScenePresence presence)
{ {
// if (IsAttachment)
// m_log.DebugFormat("AddTerseUpdateToAvatar() {0} for {1} {2}", presence.Name, Name, LocalId);
presence.SceneViewer.QueuePartForUpdate(this); presence.SceneViewer.QueuePartForUpdate(this);
} }
@ -2713,7 +2715,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ScheduleFullUpdate() public void ScheduleFullUpdate()
{ {
// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); // if (IsAttachment)
// m_log.DebugFormat("[SOP]: Scheduling full update for {0} {1}", Name, LocalId);
if (m_parentGroup != null) if (m_parentGroup != null)
{ {
@ -2826,6 +2829,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags)
{ {
// if (IsAttachment)
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Sending part full update to {0} for {1} {2}", remoteClient.Name, Name, LocalId);
m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags);
} }
@ -2834,6 +2841,10 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void SendFullUpdateToAllClients() public void SendFullUpdateToAllClients()
{ {
// if (IsAttachment)
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Sending full update for {0} {1} for all clients", Name, LocalId);
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Length; i++)
{ {
@ -2845,6 +2856,10 @@ namespace OpenSim.Region.Framework.Scenes
public void SendFullUpdateToAllClientsExcept(UUID agentID) public void SendFullUpdateToAllClientsExcept(UUID agentID)
{ {
// if (IsAttachment)
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Sending full update for {0} {1} to all clients except {2}", Name, LocalId, agentID);
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Length; i++)
{ {
@ -2900,10 +2915,27 @@ namespace OpenSim.Region.Framework.Scenes
//isattachment = ParentGroup.RootPart.IsAttachment; //isattachment = ParentGroup.RootPart.IsAttachment;
byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A};
remoteClient.SendPrimitiveToClient(new SendPrimitiveData(m_regionHandle, m_parentGroup.GetTimeDilation(), LocalId, m_shape,
lPos, Velocity, Acceleration, RotationOffset, AngularVelocity, clientFlags, m_uuid, _ownerID, double priority = ParentGroup.GetUpdatePriority(remoteClient);
m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment, if (IsRoot && IsAttachment)
AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, ParentGroup.GetUpdatePriority(remoteClient))); {
if (double.MinValue == priority)
{
m_log.WarnFormat(
"[SOP]: Couldn't raise update priority of root part for attachment {0} {1} because priority is already highest value",
Name, LocalId);
}
else
{
priority = double.MinValue;
}
}
remoteClient.SendPrimitiveToClient(
new SendPrimitiveData(m_regionHandle, m_parentGroup.GetTimeDilation(), LocalId, m_shape,
lPos, Velocity, Acceleration, RotationOffset, AngularVelocity, clientFlags, m_uuid, _ownerID,
m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment,
AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, priority));
} }
/// <summary> /// <summary>
@ -2953,6 +2985,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
{ {
// if (IsAttachment)
// m_log.DebugFormat("[SOP]: Sending scheduled full update for {0} {1}", Name, LocalId);
AddFullUpdateToAllAvatars(); AddFullUpdateToAllAvatars();
m_updateFlag = 0; //Same here m_updateFlag = 0; //Same here
} }

View File

@ -31,6 +31,7 @@ using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections; using System.Collections;
using System.Reflection; using System.Reflection;
using System.Threading;
using OpenMetaverse; using OpenMetaverse;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
@ -209,6 +210,11 @@ namespace OpenSim.Region.Framework.Scenes
if ((int)InventoryType.LSL == item.InvType) if ((int)InventoryType.LSL == item.InvType)
{ {
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
if ((int)InventoryType.LSL == item.InvType)
{
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
Thread.Sleep(10); // workaround for Mono cpu utilization > 100% bug
}
} }
} }
} }
@ -269,7 +275,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.InfoFormat( // m_log.InfoFormat(
// "[PRIM INVENTORY]: " + // "[PRIM INVENTORY]: " +
// "Starting script {0}, {1} in prim {2}, {3}", // "Starting script {0}, {1} in prim {2}, {3}",
// item.Name, item.ItemID, Name, UUID); // item.Name, item.ItemID, m_part.Name, m_part.UUID);
if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
{ {
@ -654,6 +660,7 @@ namespace OpenSim.Region.Framework.Scenes
item.ParentID = m_part.UUID; item.ParentID = m_part.UUID;
item.ParentPartID = m_part.UUID; item.ParentPartID = m_part.UUID;
item.Name = name; item.Name = name;
item.GroupID = m_part.GroupID;
m_items.LockItemsForWrite(true); m_items.LockItemsForWrite(true);
m_items.Add(item.ItemID, item); m_items.Add(item.ItemID, item);
@ -743,6 +750,11 @@ namespace OpenSim.Region.Framework.Scenes
item.ParentID = m_part.UUID; item.ParentID = m_part.UUID;
item.ParentPartID = m_part.UUID; item.ParentPartID = m_part.UUID;
item.Flags = m_items[item.ItemID].Flags; item.Flags = m_items[item.ItemID].Flags;
// If group permissions have been set on, check that the groupID is up to date in case it has
// changed since permissions were last set.
if (item.GroupPermissions != (uint)PermissionMask.None)
item.GroupID = m_part.GroupID;
if (item.AssetID == UUID.Zero) if (item.AssetID == UUID.Zero)
{ {
item.AssetID = m_items[item.ItemID].AssetID; item.AssetID = m_items[item.ItemID].AssetID;
@ -896,6 +908,7 @@ namespace OpenSim.Region.Framework.Scenes
uint everyoneMask = 0; uint everyoneMask = 0;
uint baseMask = item.BasePermissions; uint baseMask = item.BasePermissions;
uint ownerMask = item.CurrentPermissions; uint ownerMask = item.CurrentPermissions;
uint groupMask = item.GroupPermissions;
invString.AddItemStart(); invString.AddItemStart();
invString.AddNameValueLine("item_id", item.ItemID.ToString()); invString.AddNameValueLine("item_id", item.ItemID.ToString());
@ -905,7 +918,7 @@ namespace OpenSim.Region.Framework.Scenes
invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
invString.AddNameValueLine("group_mask", Utils.UIntToHexString(0)); invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask));
invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));

View File

@ -885,7 +885,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!(pos.Y < 0)) if (!(pos.Y < 0))
emergencyPos.Y = pos.Y; emergencyPos.Y = pos.Y;
if (!(pos.Z < 0)) if (!(pos.Z < 0))
emergencyPos.X = pos.X; emergencyPos.Z = pos.Z;
} }
if (pos.Y < 0) if (pos.Y < 0)
{ {
@ -903,7 +903,7 @@ namespace OpenSim.Region.Framework.Scenes
emergencyPos.Y = pos.Y; emergencyPos.Y = pos.Y;
//Leave as 128 //Leave as 128
} }
m_log.WarnFormat( m_log.WarnFormat(
"[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
pos, Name, UUID, emergencyPos); pos, Name, UUID, emergencyPos);
@ -4103,6 +4103,8 @@ namespace OpenSim.Region.Framework.Scenes
private double UpdatePriority(UpdatePriorityData data) private double UpdatePriority(UpdatePriorityData data)
{ {
// m_log.DebugFormat("[SCENE PRESENCE]: Reprioritizing updates to client {0} for {1}", Name, data.localID);
EntityBase entity; EntityBase entity;
SceneObjectGroup group; SceneObjectGroup group;

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -27,6 +27,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection;
using OpenMetaverse; using OpenMetaverse;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
@ -39,6 +40,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
public class SceneViewer : ISceneViewer public class SceneViewer : ISceneViewer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected ScenePresence m_presence; protected ScenePresence m_presence;
protected UpdateQueue m_partsUpdateQueue = new UpdateQueue(); protected UpdateQueue m_partsUpdateQueue = new UpdateQueue();
protected Queue<SceneObjectGroup> m_pendingObjects; protected Queue<SceneObjectGroup> m_pendingObjects;
@ -60,6 +63,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="part"></param> /// <param name="part"></param>
public void QueuePartForUpdate(SceneObjectPart part) public void QueuePartForUpdate(SceneObjectPart part)
{ {
// if (part.IsAttachment)
// m_log.DebugFormat("[SCENE VIEWER]: Queueing part {0} {1} for update", part.Name, part.LocalId);
lock (m_partsUpdateQueue) lock (m_partsUpdateQueue)
{ {
m_partsUpdateQueue.Enqueue(part); m_partsUpdateQueue.Enqueue(part);
@ -134,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
else if (update.LastTerseUpdateTime <= part.TimeStampTerse) else if (update.LastTerseUpdateTime <= part.TimeStampTerse)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(AddFullUpdateToAvatar
// "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}", // "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}",
// part.Name, part.UUID, part.TimeStampTerse); // part.Name, part.UUID, part.TimeStampTerse);

View File

@ -29,6 +29,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Text;
using Nwc.XmlRpc; using Nwc.XmlRpc;
@ -42,6 +43,7 @@ using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{ {
@ -72,7 +74,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
private bool m_debugEnabled = false; private bool m_debugEnabled = false;
private ExpiringCache<string, XmlRpcResponse> m_memoryCache;
private int m_cacheTimeout = 30;
// Used to track which agents are have dropped from a group chat session // Used to track which agents are have dropped from a group chat session
// Should be reset per agent, on logon // Should be reset per agent, on logon
// TODO: move this to Flotsam XmlRpc Service // TODO: move this to Flotsam XmlRpc Service
@ -132,8 +136,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30);
if (m_cacheTimeout == 0)
{
m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled.");
}
else
{
m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Timeout set to {0}.", m_cacheTimeout);
}
// If we got all the config options we need, lets start'er'up // If we got all the config options we need, lets start'er'up
m_memoryCache = new ExpiringCache<string, XmlRpcResponse>();
m_connectorEnabled = true; m_connectorEnabled = true;
} }
} }
@ -921,61 +935,94 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
/// </summary> /// </summary>
private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param)
{ {
string UserService;
UUID SessionID;
GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
param.Add("RequestingAgentID", requestingAgentID.ToString());
param.Add("RequestingAgentUserService", UserService);
param.Add("RequestingSessionID", SessionID.ToString());
param.Add("ReadKey", m_groupReadKey);
param.Add("WriteKey", m_groupWriteKey);
if (m_debugEnabled)
{
m_log.Debug("[XMLRPCGROUPDATA] XmlRpcCall Params:");
foreach (string key in param.Keys)
{
m_log.DebugFormat("[XMLRPCGROUPDATA] {0} : {1}", key, param[key]);
}
}
IList parameters = new ArrayList();
parameters.Add(param);
ConfigurableKeepAliveXmlRpcRequest req;
req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
XmlRpcResponse resp = null; XmlRpcResponse resp = null;
string CacheKey = null;
try // Only bother with the cache if it isn't disabled.
if (m_cacheTimeout > 0)
{ {
resp = req.Send(m_groupsServerURI, 10000); if (!function.StartsWith("groups.get"))
{
// Any and all updates cause the cache to clear
m_memoryCache.Clear();
}
else
{
StringBuilder sb = new StringBuilder(requestingAgentID + function);
foreach (object key in param.Keys)
{
if (param[key] != null)
{
sb.AppendFormat(",{0}:{1}", key.ToString(), param[key].ToString());
}
}
CacheKey = sb.ToString();
m_memoryCache.TryGetValue(CacheKey, out resp);
}
} }
catch (Exception e)
if (resp == null)
{ {
string UserService;
UUID SessionID;
GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
param.Add("RequestingAgentID", requestingAgentID.ToString());
param.Add("RequestingAgentUserService", UserService);
param.Add("RequestingSessionID", SessionID.ToString());
m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); param.Add("ReadKey", m_groupReadKey);
m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); param.Add("WriteKey", m_groupWriteKey);
if ((req != null) && (req.RequestResponse != null)) if (m_debugEnabled)
{ {
foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) m_log.Debug("[XMLRPCGROUPDATA] XmlRpcCall Params:");
foreach (string key in param.Keys)
{
m_log.DebugFormat("[XMLRPCGROUPDATA] {0} : {1}", key, param[key]);
}
}
IList parameters = new ArrayList();
parameters.Add(param);
ConfigurableKeepAliveXmlRpcRequest req;
req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
try
{ {
m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); resp = req.Send(m_groupsServerURI, 10000);
if ((m_cacheTimeout > 0) && (CacheKey != null))
{
m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
}
} }
} catch (Exception e)
foreach (string key in param.Keys)
{ {
m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString());
m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function);
m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString());
if ((req != null) && (req.RequestResponse != null))
{
foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
{
m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine);
}
}
foreach (string key in param.Keys)
{
m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString());
}
Hashtable respData = new Hashtable();
respData.Add("error", e.ToString());
return respData;
} }
Hashtable respData = new Hashtable();
respData.Add("error", e.ToString());
return respData;
} }

View File

@ -467,13 +467,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llVecNorm(LSL_Vector v) public LSL_Vector llVecNorm(LSL_Vector v)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
double mag = LSL_Vector.Mag(v); return LSL_Vector.Norm(v);
LSL_Vector nor = new LSL_Vector();
nor.x = v.x / mag;
nor.y = v.y / mag;
nor.z = v.z / mag;
return nor;
} }
public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b)

View File

@ -257,12 +257,17 @@ namespace OpenSim.Region.ScriptEngine.Shared
public static double Mag(Vector3 v) public static double Mag(Vector3 v)
{ {
return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
} }
public static Vector3 Norm(Vector3 vector) public static Vector3 Norm(Vector3 vector)
{ {
double mag = Mag(vector); double mag = Mag(vector);
return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); if (mag > 0.0)
{
double invMag = 1.0 / mag;
return vector * invMag;
}
return new Vector3(0, 0, 0);
} }
#endregion #endregion

View File

@ -125,6 +125,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private ScriptCompileQueue m_CompileQueue = new ScriptCompileQueue(); private ScriptCompileQueue m_CompileQueue = new ScriptCompileQueue();
IWorkItemResult m_CurrentCompile = null; IWorkItemResult m_CurrentCompile = null;
private Dictionary<UUID, int> m_CompileDict = new Dictionary<UUID, int>();
private void lockScriptsForRead(bool locked) private void lockScriptsForRead(bool locked)
{ {
@ -555,11 +556,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (stateSource == (int)StateSource.ScriptedRez) if (stateSource == (int)StateSource.ScriptedRez)
{ {
lock (m_CompileDict)
{
m_CompileDict[itemID] = 0;
}
DoOnRezScript(parms); DoOnRezScript(parms);
} }
else else
{ {
m_CompileQueue.Enqueue(parms); m_CompileQueue.Enqueue(parms);
lock (m_CompileDict)
{
m_CompileDict[itemID] = 0;
}
if (m_CurrentCompile == null) if (m_CurrentCompile == null)
{ {
@ -622,6 +632,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
bool postOnRez = (bool)p[4]; bool postOnRez = (bool)p[4];
StateSource stateSource = (StateSource)p[5]; StateSource stateSource = (StateSource)p[5];
lock(m_CompileDict)
{
if (!m_CompileDict.ContainsKey(itemID))
return false;
m_CompileDict.Remove(itemID);
}
// Get the asset ID of the script, so we can check if we // Get the asset ID of the script, so we can check if we
// already have it. // already have it.
@ -868,9 +885,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public void OnRemoveScript(uint localID, UUID itemID) public void OnRemoveScript(uint localID, UUID itemID)
{ {
lockScriptsForRead(true); // If it's not yet been compiled, make sure we don't try
// Do we even have it? lock (m_CompileDict)
if (!m_Scripts.ContainsKey(itemID)) {
if (m_CompileDict.ContainsKey(itemID))
m_CompileDict.Remove(itemID);
}
lock (m_Scripts)
{ {
lockScriptsForRead(false); lockScriptsForRead(false);
return; return;
@ -1375,10 +1397,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
try try
{ {
FileStream tfs = File.Open(assemName + ".text", using (FileStream tfs = File.Open(assemName + ".text",
FileMode.Open, FileAccess.Read); FileMode.Open, FileAccess.Read))
tfs.Read(tdata, 0, tdata.Length); {
tfs.Close(); tfs.Read(tdata, 0, tdata.Length);
tfs.Close();
}
assem = new System.Text.ASCIIEncoding().GetString(tdata); assem = new System.Text.ASCIIEncoding().GetString(tdata);
} }
@ -1398,9 +1422,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
try try
{ {
FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read); using (FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read))
fs.Read(data, 0, data.Length); {
fs.Close(); fs.Read(data, 0, data.Length);
fs.Close();
}
assem = System.Convert.ToBase64String(data); assem = System.Convert.ToBase64String(data);
} }
@ -1416,13 +1442,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (File.Exists(fn + ".map")) if (File.Exists(fn + ".map"))
{ {
FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read); using (FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read))
StreamReader msr = new StreamReader(mfs); {
using (StreamReader msr = new StreamReader(mfs))
map = msr.ReadToEnd(); {
map = msr.ReadToEnd();
msr.Close(); msr.Close();
mfs.Close(); }
mfs.Close();
}
} }
XmlElement assemblyData = doc.CreateElement("", "Assembly", ""); XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
@ -1510,30 +1538,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{ {
Byte[] filedata = Convert.FromBase64String(base64); Byte[] filedata = Convert.FromBase64String(base64);
FileStream fs = File.Create(path); try
fs.Write(filedata, 0, filedata.Length); {
fs.Close(); using (FileStream fs = File.Create(path))
{
fs = File.Create(path + ".text"); fs.Write(filedata, 0, filedata.Length);
StreamWriter sw = new StreamWriter(fs); fs.Close();
}
sw.Write(base64); }
catch (IOException ex)
sw.Close(); {
fs.Close(); // if there already exists a file at that location, it may be locked.
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
}
try
{
using (FileStream fs = File.Create(path + ".text"))
{
using (StreamWriter sw = new StreamWriter(fs))
{
sw.Write(base64);
sw.Close();
}
fs.Close();
}
}
catch (IOException ex)
{
// if there already exists a file at that location, it may be locked.
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
}
} }
} }
string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
statepath = Path.Combine(statepath, itemID.ToString() + ".state"); statepath = Path.Combine(statepath, itemID.ToString() + ".state");
FileStream sfs = File.Create(statepath); try
StreamWriter ssw = new StreamWriter(sfs); {
using (FileStream sfs = File.Create(statepath))
ssw.Write(stateE.OuterXml); {
using (StreamWriter ssw = new StreamWriter(sfs))
ssw.Close(); {
sfs.Close(); ssw.Write(stateE.OuterXml);
ssw.Close();
}
sfs.Close();
}
}
catch (IOException ex)
{
// if there already exists a file at that location, it may be locked.
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
}
XmlNodeList mapL = rootE.GetElementsByTagName("LineMap"); XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
if (mapL.Count > 0) if (mapL.Count > 0)
@ -1543,13 +1600,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
FileStream mfs = File.Create(mappath); try
StreamWriter msw = new StreamWriter(mfs); {
using (FileStream mfs = File.Create(mappath))
msw.Write(mapE.InnerText); {
using (StreamWriter msw = new StreamWriter(mfs))
msw.Close(); {
mfs.Close(); msw.Write(mapE.InnerText);
msw.Close();
}
mfs.Close();
}
}
catch (IOException ex)
{
// if there already exists a file at that location, it may be locked.
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
}
} }
return true; return true;

View File

@ -13,6 +13,8 @@
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console"> <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{HH:mm:ss} - %message" /> <conversionPattern value="%date{HH:mm:ss} - %message" />
<!-- Use the line below instead of the one above if you want milliseconds in your log timestamps -->
<!-- <conversionPattern value="%date{HH:mm:ss,fff} - %message" /> -->
</layout> </layout>
</appender> </appender>

View File

@ -1302,39 +1302,35 @@
[Groups] [Groups]
Enabled = false Enabled = false
; This is the current groups stub in Region.CoreModules.Avatar.Groups ; This is the current groups stub in Region.CoreModules.Avatar.Groups. All the other settings below only really
; apply to the Flotsam GroupsModule
Module = Default Module = Default
; The PHP code for the server is available from the Flotsam project for you to deploy ; This module can use a PHP XmlRpc server from the Flotsam project at http://code.google.com/p/flotsam/
; to your own server. The Flotsam project is located at http://code.google.com/p/flotsam/
;
;Module = GroupsModule ;Module = GroupsModule
; Enable Group Notices ; Enable Group Notices
;NoticesEnabled = true ;NoticesEnabled = true
; This makes the Groups modules very chatty on the console. ; This makes the Groups modules very chatty on the console.
DebugEnabled = false DebugEnabled = false
; Specify which messaging module to use for groups messaging and if it's enabled ; Specify which messaging module to use for groups messaging and if it's enabled
;MessagingModule = GroupsMessagingModule ;MessagingModule = GroupsMessagingModule
;MessagingEnabled = true ;MessagingEnabled = true
; Service connector to Groups Service [Select One] ServicesConnectorModule ; Flotsam XmlRpc Service for Groups. Uncomment these settings and change accordingly if you are using this backend groups service
; XmlRpc Service Connector to the Flotsam XmlRpc Groups Service settings
;ServicesConnectorModule = XmlRpcGroupsServicesConnector ;ServicesConnectorModule = XmlRpcGroupsServicesConnector
;GroupsServerURI = http://yourxmlrpcserver.com/xmlrpc.php ;GroupsServerURI = http://yourxmlrpcserver.com/xmlrpc.php
; XmlRpc Service Settings ; XmlRpc Security settings. These must match those set on your backend groups service.
;XmlRpcServiceReadKey = 1234 ;XmlRpcServiceReadKey = 1234
;XmlRpcServiceWriteKey = 1234 ;XmlRpcServiceWriteKey = 1234
; Disables HTTP Keep-Alive for XmlRpcGroupsServicesConnector HTTP Requests, ; Disables HTTP Keep-Alive for XmlRpcGroupsServicesConnector HTTP Requests,
; this is a work around fora problem discovered on some Windows based region servers. ; this is a work around fora problem discovered on some Windows based region servers.
; Only disable keep alive if you see a large number (dozens) of the following Exceptions: ; Only disable keep alive if you see a large number (dozens) of the following Exceptions:
; System.Net.WebException: The request was aborted: The request was canceled. ; System.Net.WebException: The request was aborted: The request was canceled.
;
; XmlRpcDisableKeepAlive = false ; XmlRpcDisableKeepAlive = false