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>
<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">
<arg value="./bin/OpenSim.Framework.Servers.Tests.dll" />
</exec>
@ -160,17 +155,6 @@
<arg value="--export-html=./cov/OpenSim.Framework.Servers ./cov/OpenSim.Framework.Servers.cov" />
</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">
<arg value="&#45;&#45;debug" />
@ -281,11 +265,6 @@
<arg value="-xml=test-results/OpenSim.Framework.Tests.dll-Results.xml" />
</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">
<arg value="./bin/OpenSim.Framework.Serialization.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Framework.Serialization.Tests.dll-Results.xml" />
@ -355,7 +334,6 @@
<!-- <test> -->
<!-- <assemblies> -->
<!-- <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.Region.ClientStack.LindenUDP.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/
* 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
}
finally
@ -176,7 +176,6 @@ namespace OpenSim.Framework.Communications.Clients
}
return true;
}
public bool DoChildAgentUpdateCall(GridRegion region, IAgentData cAgentData)

View File

@ -98,6 +98,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary>
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
public event GenericMessage OnGenericMessage;
@ -365,6 +370,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </value>
protected HashSet<uint> m_killRecord;
// protected HashSet<uint> m_attachmentsQueued;
// protected HashSet<uint> m_attachmentsSent;
private int m_moneyBalance;
private int m_animationSequenceNumber = 1;
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_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
m_killRecord = new HashSet<uint>();
// m_attachmentsQueued = new HashSet<uint>();
// m_attachmentsSent = new HashSet<uint>();
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
@ -485,6 +495,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SetDebugPacketLevel(int newDebug)
{
m_debugPacketLevel = newDebug;
}
#region Client Methods
@ -670,7 +681,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
AsyncPacketProcess packetObject = (AsyncPacketProcess)state;
packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack);
}
#endregion Packet Handling
@ -3397,6 +3407,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data);
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>
@ -3499,8 +3512,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// if (text.IndexOf("\n") >= 0)
// text = text.Remove(text.IndexOf("\n"));
// m_log.DebugFormat(
// "[CLIENT]: Placing request to send full info about prim {0} text {1} to client {2}",
// data.localID, text, Name);
// "[CLIENT]: Queueing send full info about prim {0}, attachment {1}, text {2} to client {3}",
// data.localID, data.attachment, text, Name);
if (data.priority == double.NaN)
{
@ -3519,6 +3532,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ObjectUpdatePacket.ObjectDataBlock objectData = CreatePrimUpdateBlock(data);
// if (data.attachment)
// m_attachmentsQueued.Add(data.localID);
lock (m_primFullUpdates.SyncRoot)
m_primFullUpdates.Enqueue(data.priority, objectData, data.localID);
}
@ -3545,14 +3561,36 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (!m_killRecord.Contains(block.ID))
{
m_fullUpdateDataBlocksBuilder.Add(block);
// string text = Util.FieldToString(outPacket.ObjectData[i].Text);
// 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 prim {0} text {1} to client {2}",
// outPacket.ObjectData[i].ID, text, Name);
// "[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);
// }
}
// else
// {
@ -4504,6 +4542,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
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];
data.pos.ToBytes(objectData, 0);
data.vel.ToBytes(objectData, 12);
@ -7053,33 +7096,90 @@ namespace OpenSim.Region.ClientStack.LindenUDP
taskID = new UUID(transfer.TransferInfo.Params, 48);
UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
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 (taskID != UUID.Zero) // Prim
{
SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
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;
}
if (part.OwnerID != AgentId)
TaskInventoryItem tii = part.Inventory.GetInventoryItem(itemID);
if (tii == null)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
Name, requestID, itemID, taskID);
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;
}
TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID);
if (ti == null)
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 (ti.OwnerID != AgentId)
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 ((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)
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
{
IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
@ -7114,10 +7214,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
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;
}
}
}
}
//m_assetCache.AddAssetRequest(this, transfer);
@ -7661,12 +7766,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask;
newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask;
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.Type = updatetask.InventoryData.Type;
newTaskItem.InvType = updatetask.InventoryData.InvType;
newTaskItem.Flags = updatetask.InventoryData.Flags;
//newTaskItem.SaleType=updatetask.InventoryData.SaleType;
//newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;;
//newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;
newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name);
newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description);
newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate;
@ -10977,7 +11085,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
LLUDPServer.LogPacketHeader(false, m_circuitCode, 0, packet.Type, (ushort)packet.Length);
#endregion BinaryStats
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true);
OutPacket(packet, throttlePacketType, true);
}
/// <summary>
@ -10990,6 +11098,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// handles splitting manually</param>
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);
}
@ -11061,10 +11172,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="Pack">OpenMetaverse.packet</param>
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))
m_log.Warn("[CLIENT]: unhandled packet " + Pack);
m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type);
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.Debug("asset request " + requestID);
// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
@ -11589,6 +11700,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public PacketMethod method;
public bool Async;
}
public class AsyncPacketProcess
{
public bool result = false;

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> GrantJS = 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
@ -369,9 +370,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
if (m_friendsModule == null)
m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work");
else
m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled");
m_log.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work");
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()
@ -406,15 +410,34 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// with the powers requested (powers = 0 for no powers check)
protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
{
//DateTime t1 = DateTime.Now;
bool result = false;
ScenePresence sp = m_scene.GetScenePresence(userID);
if (sp != null)
{
IClientAPI client = sp.ControllingClient;
return ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) &&
result = ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) &&
((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>
@ -704,8 +727,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
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
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 true;
@ -940,7 +972,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericObjectPermission(editorID, objectID, false);
}
@ -1047,7 +1078,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if ((part.GroupMask & (uint)PermissionMask.Modify) == 0)
return false;
} else {
}
else
{
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return false;
}
@ -1477,7 +1510,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if ((part.GroupMask & (uint)PermissionMask.Modify) == 0)
return false;
} else {
}
else
{
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return false;
}
@ -1732,7 +1767,69 @@ namespace OpenSim.Region.CoreModules.World.Permissions
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);
switch (scriptType) {
case 0:

View File

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

View File

@ -1874,6 +1874,28 @@ namespace OpenSim.Region.Framework.Scenes
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>
/// Add an object into the scene that has come from storage
/// </summary>
@ -1893,7 +1915,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
{
return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted);
return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true);
}
/// <summary>
@ -2578,10 +2600,12 @@ namespace OpenSim.Region.Framework.Scenes
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.Phantom);
AddRestoredSceneObject(sceneObject, false, false);
AddRestoredSceneObject(sceneObject, false, false, false);
// Handle attachment special case
SceneObjectPart RootPrim = sceneObject.RootPart;
@ -2589,6 +2613,8 @@ namespace OpenSim.Region.Framework.Scenes
// Fix up attachment Parent Local ID
ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
// Console.WriteLine("AAAA");
//uint parentLocalID = 0;
if (sp != null)
{
@ -2608,19 +2634,24 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat(
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
AttachObject(
sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
grp.SendGroupFullUpdate();
//grp.SendGroupFullUpdate();
}
else
{
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
}
// Console.WriteLine("BBBB");
}
else
{
// m_log.DebugFormat("[SCENE]: Adding ordinary object {0} {1}", sceneObject.Name, sceneObject.LocalId);
AddRestoredSceneObject(sceneObject, true, false);
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
agent.SendInitialFullUpdateToAllClients();
// Console.WriteLine("SCS 1");
agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true);
// Console.WriteLine("SCS 2");
// 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 false, we'll persist this object immediately
/// </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>
/// 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)
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
{
// KF: Check for out-of-region, move inside and make static.
Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X,
@ -252,9 +256,30 @@ namespace OpenSim.Region.Framework.Scenes
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>
/// Add a newly created object to the scene. This will both update the scene, and send information about the
/// new object to all clients interested in the scene.
@ -647,11 +672,13 @@ namespace OpenSim.Region.Framework.Scenes
protected internal bool AttachObject(
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
{
// Console.WriteLine("HERE A");
SceneObjectGroup group = GetGroupByPrim(objectLocalID);
if (group != null)
{
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
// set it's offset position = 0 so that it appears on the attachment point
// and not in a weird location somewhere unknown.
@ -690,9 +717,12 @@ namespace OpenSim.Region.Framework.Scenes
itemId = group.GetFromItemID();
}
// Console.WriteLine("HERE 0");
m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group);
// Console.WriteLine("HERE 1");
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
// Console.WriteLine("HERE 2");
// In case it is later dropped again, don't let
// it get cleaned up
//

View File

@ -422,7 +422,7 @@ namespace OpenSim.Region.Framework.Scenes
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.Lastname,
newDebug);

View File

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

View File

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

View File

@ -1273,13 +1273,14 @@ namespace OpenSim.Region.Framework.Scenes
{
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++)
{
avatars[i].SceneViewer.QueuePartForUpdate(this);
}
AddFullUpdateToAvatar(avatars[i]);
}
public void AddFullUpdateToAvatar(ScenePresence presence)
{
// if (IsAttachment)
// m_log.DebugFormat("AddFullUpdateToAllAvatar() {0} for {1} {2}", presence.Name, Name, LocalId);
presence.SceneViewer.QueuePartForUpdate(this);
}
@ -1298,13 +1299,14 @@ namespace OpenSim.Region.Framework.Scenes
{
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++)
{
avatars[i].SceneViewer.QueuePartForUpdate(this);
}
AddTerseUpdateToAvatar(avatars[i]);
}
public void AddTerseUpdateToAvatar(ScenePresence presence)
{
// if (IsAttachment)
// m_log.DebugFormat("AddTerseUpdateToAvatar() {0} for {1} {2}", presence.Name, Name, LocalId);
presence.SceneViewer.QueuePartForUpdate(this);
}
@ -2713,7 +2715,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
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)
{
@ -2826,6 +2829,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param>
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);
}
@ -2834,6 +2841,10 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
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();
for (int i = 0; i < avatars.Length; i++)
{
@ -2845,6 +2856,10 @@ namespace OpenSim.Region.Framework.Scenes
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();
for (int i = 0; i < avatars.Length; i++)
{
@ -2900,10 +2915,27 @@ namespace OpenSim.Region.Framework.Scenes
//isattachment = ParentGroup.RootPart.IsAttachment;
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,
double priority = ParentGroup.GetUpdatePriority(remoteClient);
if (IsRoot && IsAttachment)
{
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, ParentGroup.GetUpdatePriority(remoteClient)));
AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, priority));
}
/// <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 (IsAttachment)
// m_log.DebugFormat("[SOP]: Sending scheduled full update for {0} {1}", Name, LocalId);
AddFullUpdateToAllAvatars();
m_updateFlag = 0; //Same here
}

View File

@ -31,6 +31,7 @@ using System.IO;
using System.Collections.Generic;
using System.Collections;
using System.Reflection;
using System.Threading;
using OpenMetaverse;
using log4net;
using OpenSim.Framework;
@ -209,6 +210,11 @@ namespace OpenSim.Region.Framework.Scenes
if ((int)InventoryType.LSL == item.InvType)
{
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(
// "[PRIM INVENTORY]: " +
// "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))
{
@ -654,6 +660,7 @@ namespace OpenSim.Region.Framework.Scenes
item.ParentID = m_part.UUID;
item.ParentPartID = m_part.UUID;
item.Name = name;
item.GroupID = m_part.GroupID;
m_items.LockItemsForWrite(true);
m_items.Add(item.ItemID, item);
@ -743,6 +750,11 @@ namespace OpenSim.Region.Framework.Scenes
item.ParentID = m_part.UUID;
item.ParentPartID = m_part.UUID;
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)
{
item.AssetID = m_items[item.ItemID].AssetID;
@ -896,6 +908,7 @@ namespace OpenSim.Region.Framework.Scenes
uint everyoneMask = 0;
uint baseMask = item.BasePermissions;
uint ownerMask = item.CurrentPermissions;
uint groupMask = item.GroupPermissions;
invString.AddItemStart();
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("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("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));

View File

@ -885,7 +885,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!(pos.Y < 0))
emergencyPos.Y = pos.Y;
if (!(pos.Z < 0))
emergencyPos.X = pos.X;
emergencyPos.Z = pos.Z;
}
if (pos.Y < 0)
{
@ -4103,6 +4103,8 @@ namespace OpenSim.Region.Framework.Scenes
private double UpdatePriority(UpdatePriorityData data)
{
// m_log.DebugFormat("[SCENE PRESENCE]: Reprioritizing updates to client {0} for {1}", Name, data.localID);
EntityBase entity;
SceneObjectGroup group;

View File

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

View File

@ -29,6 +29,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using Nwc.XmlRpc;
@ -42,6 +43,7 @@ using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{
@ -72,6 +74,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
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
// Should be reset per agent, on logon
@ -132,8 +136,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
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
m_memoryCache = new ExpiringCache<string, XmlRpcResponse>();
m_connectorEnabled = true;
}
}
@ -920,6 +934,35 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
/// Encapsulate the XmlRpc call to standardize security and error handling.
/// </summary>
private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param)
{
XmlRpcResponse resp = null;
string CacheKey = null;
// Only bother with the cache if it isn't disabled.
if (m_cacheTimeout > 0)
{
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);
}
}
if (resp == null)
{
string UserService;
UUID SessionID;
@ -947,11 +990,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
ConfigurableKeepAliveXmlRpcRequest req;
req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
XmlRpcResponse resp = null;
try
{
resp = req.Send(m_groupsServerURI, 10000);
if ((m_cacheTimeout > 0) && (CacheKey != null))
{
m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
}
}
catch (Exception e)
{
@ -977,6 +1023,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
respData.Add("error", e.ToString());
return respData;
}
}
if (resp.Value is Hashtable)

View File

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

View File

@ -262,7 +262,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
public static Vector3 Norm(Vector3 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

View File

@ -125,6 +125,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private ScriptCompileQueue m_CompileQueue = new ScriptCompileQueue();
IWorkItemResult m_CurrentCompile = null;
private Dictionary<UUID, int> m_CompileDict = new Dictionary<UUID, int>();
private void lockScriptsForRead(bool locked)
{
@ -555,11 +556,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (stateSource == (int)StateSource.ScriptedRez)
{
lock (m_CompileDict)
{
m_CompileDict[itemID] = 0;
}
DoOnRezScript(parms);
}
else
{
m_CompileQueue.Enqueue(parms);
lock (m_CompileDict)
{
m_CompileDict[itemID] = 0;
}
if (m_CurrentCompile == null)
{
@ -622,6 +632,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
bool postOnRez = (bool)p[4];
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
// already have it.
@ -868,9 +885,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public void OnRemoveScript(uint localID, UUID itemID)
{
lockScriptsForRead(true);
// Do we even have it?
if (!m_Scripts.ContainsKey(itemID))
// If it's not yet been compiled, make sure we don't try
lock (m_CompileDict)
{
if (m_CompileDict.ContainsKey(itemID))
m_CompileDict.Remove(itemID);
}
lock (m_Scripts)
{
lockScriptsForRead(false);
return;
@ -1375,10 +1397,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
try
{
FileStream tfs = File.Open(assemName + ".text",
FileMode.Open, FileAccess.Read);
using (FileStream tfs = File.Open(assemName + ".text",
FileMode.Open, FileAccess.Read))
{
tfs.Read(tdata, 0, tdata.Length);
tfs.Close();
}
assem = new System.Text.ASCIIEncoding().GetString(tdata);
}
@ -1398,9 +1422,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
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();
}
assem = System.Convert.ToBase64String(data);
}
@ -1416,14 +1442,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (File.Exists(fn + ".map"))
{
FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read);
StreamReader msr = new StreamReader(mfs);
using (FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read))
{
using (StreamReader msr = new StreamReader(mfs))
{
map = msr.ReadToEnd();
msr.Close();
}
mfs.Close();
}
}
XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", "");
@ -1510,30 +1538,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{
Byte[] filedata = Convert.FromBase64String(base64);
FileStream fs = File.Create(path);
try
{
using (FileStream fs = File.Create(path))
{
fs.Write(filedata, 0, filedata.Length);
fs.Close();
fs = File.Create(path + ".text");
StreamWriter sw = new StreamWriter(fs);
}
}
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);
}
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());
statepath = Path.Combine(statepath, itemID.ToString() + ".state");
FileStream sfs = File.Create(statepath);
StreamWriter ssw = new StreamWriter(sfs);
try
{
using (FileStream sfs = File.Create(statepath))
{
using (StreamWriter ssw = new StreamWriter(sfs))
{
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");
if (mapL.Count > 0)
@ -1543,14 +1600,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine
string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
FileStream mfs = File.Create(mappath);
StreamWriter msw = new StreamWriter(mfs);
try
{
using (FileStream mfs = File.Create(mappath))
{
using (StreamWriter msw = new StreamWriter(mfs))
{
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;
}

View File

@ -13,6 +13,8 @@
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
<layout type="log4net.Layout.PatternLayout">
<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>
</appender>

View File

@ -1302,12 +1302,11 @@
[Groups]
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
; The PHP code for the server is available from the Flotsam project for you to deploy
; to your own server. The Flotsam project is located at http://code.google.com/p/flotsam/
;
; This module can use a PHP XmlRpc server from the Flotsam project at http://code.google.com/p/flotsam/
;Module = GroupsModule
; Enable Group Notices
@ -1320,13 +1319,11 @@
;MessagingModule = GroupsMessagingModule
;MessagingEnabled = true
; Service connector to Groups Service [Select One] ServicesConnectorModule
; XmlRpc Service Connector to the Flotsam XmlRpc Groups Service settings
; Flotsam XmlRpc Service for Groups. Uncomment these settings and change accordingly if you are using this backend groups service
;ServicesConnectorModule = XmlRpcGroupsServicesConnector
;GroupsServerURI = http://yourxmlrpcserver.com/xmlrpc.php
; XmlRpc Service Settings
; XmlRpc Security settings. These must match those set on your backend groups service.
;XmlRpcServiceReadKey = 1234
;XmlRpcServiceWriteKey = 1234
@ -1334,7 +1331,6 @@
; 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:
; System.Net.WebException: The request was aborted: The request was canceled.
;
; XmlRpcDisableKeepAlive = false