diff options
author | Melanie | 2010-07-17 03:09:27 +0100 |
---|---|---|
committer | Melanie | 2010-07-17 03:09:27 +0100 |
commit | 6f591376dd22c05d297dec6e5fe0d78e47a7d0ff (patch) | |
tree | 52ba1d530eef192274471b212afe1fdec7715cb8 /OpenSim/Region | |
parent | Merge branch '0.6.9-post-fixes' into careminster (diff) | |
parent | Stop occasional permanently high 100% utilization when the server is started ... (diff) | |
download | opensim-SC_OLD-6f591376dd22c05d297dec6e5fe0d78e47a7d0ff.zip opensim-SC_OLD-6f591376dd22c05d297dec6e5fe0d78e47a7d0ff.tar.gz opensim-SC_OLD-6f591376dd22c05d297dec6e5fe0d78e47a7d0ff.tar.bz2 opensim-SC_OLD-6f591376dd22c05d297dec6e5fe0d78e47a7d0ff.tar.xz |
Merge branch '0.6.9-post-fixes' into careminster
Diffstat (limited to 'OpenSim/Region')
19 files changed, 643 insertions, 184 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7e85396..0e4a0d0 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -98,6 +98,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
98 | /// </summary> | 98 | /// </summary> |
99 | public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector | 99 | public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector |
100 | { | 100 | { |
101 | /// <value> | ||
102 | /// Debug packet level. At the moment, only 255 does anything (prints out all in and out packets). | ||
103 | /// </value> | ||
104 | protected int m_debugPacketLevel = 0; | ||
105 | |||
101 | #region Events | 106 | #region Events |
102 | 107 | ||
103 | public event GenericMessage OnGenericMessage; | 108 | public event GenericMessage OnGenericMessage; |
@@ -365,6 +370,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
365 | /// </value> | 370 | /// </value> |
366 | protected HashSet<uint> m_killRecord; | 371 | protected HashSet<uint> m_killRecord; |
367 | 372 | ||
373 | // protected HashSet<uint> m_attachmentsQueued; | ||
374 | // protected HashSet<uint> m_attachmentsSent; | ||
375 | |||
368 | private int m_moneyBalance; | 376 | private int m_moneyBalance; |
369 | private int m_animationSequenceNumber = 1; | 377 | private int m_animationSequenceNumber = 1; |
370 | private bool m_SendLogoutPacketWhenClosing = true; | 378 | private bool m_SendLogoutPacketWhenClosing = true; |
@@ -456,6 +464,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
456 | m_primFullUpdates = new PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock>(m_scene.Entities.Count); | 464 | m_primFullUpdates = new PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock>(m_scene.Entities.Count); |
457 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); | 465 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); |
458 | m_killRecord = new HashSet<uint>(); | 466 | m_killRecord = new HashSet<uint>(); |
467 | // m_attachmentsQueued = new HashSet<uint>(); | ||
468 | // m_attachmentsSent = new HashSet<uint>(); | ||
459 | 469 | ||
460 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | 470 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); |
461 | m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>(); | 471 | m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>(); |
@@ -485,6 +495,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
485 | 495 | ||
486 | public void SetDebugPacketLevel(int newDebug) | 496 | public void SetDebugPacketLevel(int newDebug) |
487 | { | 497 | { |
498 | m_debugPacketLevel = newDebug; | ||
488 | } | 499 | } |
489 | 500 | ||
490 | #region Client Methods | 501 | #region Client Methods |
@@ -669,8 +680,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
669 | public void ProcessSpecificPacketAsync(object state) | 680 | public void ProcessSpecificPacketAsync(object state) |
670 | { | 681 | { |
671 | AsyncPacketProcess packetObject = (AsyncPacketProcess)state; | 682 | AsyncPacketProcess packetObject = (AsyncPacketProcess)state; |
672 | packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack); | 683 | packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack); |
673 | |||
674 | } | 684 | } |
675 | 685 | ||
676 | #endregion Packet Handling | 686 | #endregion Packet Handling |
@@ -3397,6 +3407,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3397 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 3407 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
3398 | objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); | 3408 | objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); |
3399 | OutPacket(objupdate, ThrottleOutPacketType.Task); | 3409 | OutPacket(objupdate, ThrottleOutPacketType.Task); |
3410 | |||
3411 | // We need to record the avatar local id since the root prim of an attachment points to this. | ||
3412 | // m_attachmentsSent.Add(data.AvatarLocalID); | ||
3400 | } | 3413 | } |
3401 | 3414 | ||
3402 | /// <summary> | 3415 | /// <summary> |
@@ -3499,8 +3512,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3499 | // if (text.IndexOf("\n") >= 0) | 3512 | // if (text.IndexOf("\n") >= 0) |
3500 | // text = text.Remove(text.IndexOf("\n")); | 3513 | // text = text.Remove(text.IndexOf("\n")); |
3501 | // m_log.DebugFormat( | 3514 | // m_log.DebugFormat( |
3502 | // "[CLIENT]: Placing request to send full info about prim {0} text {1} to client {2}", | 3515 | // "[CLIENT]: Queueing send full info about prim {0}, attachment {1}, text {2} to client {3}", |
3503 | // data.localID, text, Name); | 3516 | // data.localID, data.attachment, text, Name); |
3504 | 3517 | ||
3505 | if (data.priority == double.NaN) | 3518 | if (data.priority == double.NaN) |
3506 | { | 3519 | { |
@@ -3518,6 +3531,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3518 | return; | 3531 | return; |
3519 | 3532 | ||
3520 | ObjectUpdatePacket.ObjectDataBlock objectData = CreatePrimUpdateBlock(data); | 3533 | ObjectUpdatePacket.ObjectDataBlock objectData = CreatePrimUpdateBlock(data); |
3534 | |||
3535 | // if (data.attachment) | ||
3536 | // m_attachmentsQueued.Add(data.localID); | ||
3521 | 3537 | ||
3522 | lock (m_primFullUpdates.SyncRoot) | 3538 | lock (m_primFullUpdates.SyncRoot) |
3523 | m_primFullUpdates.Enqueue(data.priority, objectData, data.localID); | 3539 | m_primFullUpdates.Enqueue(data.priority, objectData, data.localID); |
@@ -3544,15 +3560,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3544 | ObjectUpdatePacket.ObjectDataBlock block = m_primFullUpdates.Dequeue(); | 3560 | ObjectUpdatePacket.ObjectDataBlock block = m_primFullUpdates.Dequeue(); |
3545 | 3561 | ||
3546 | if (!m_killRecord.Contains(block.ID)) | 3562 | if (!m_killRecord.Contains(block.ID)) |
3547 | { | 3563 | { |
3564 | // if (m_attachmentsQueued.Contains(block.ID)) | ||
3565 | // { | ||
3566 | // string text = Util.FieldToString(block.Text); | ||
3567 | // if (text.IndexOf("\n") >= 0) | ||
3568 | // text = text.Remove(text.IndexOf("\n")); | ||
3569 | // | ||
3570 | // if (m_attachmentsSent.Contains(block.ParentID)) | ||
3571 | // { | ||
3572 | // m_log.DebugFormat( | ||
3573 | // "[CLIENT]: Sending full info about attached prim {0} text {1}", | ||
3574 | // block.ID, text); | ||
3575 | // | ||
3576 | // m_fullUpdateDataBlocksBuilder.Add(block); | ||
3577 | // | ||
3578 | // m_attachmentsSent.Add(block.ID); | ||
3579 | // } | ||
3580 | // else | ||
3581 | // { | ||
3582 | // m_log.DebugFormat( | ||
3583 | // "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", | ||
3584 | // block.ID, text, block.ParentID); | ||
3585 | // | ||
3586 | // lock (m_primFullUpdates.SyncRoot) | ||
3587 | // m_primFullUpdates.Enqueue(double.MaxValue, block, block.ID); | ||
3588 | // } | ||
3589 | // } | ||
3590 | // else | ||
3591 | // { | ||
3548 | m_fullUpdateDataBlocksBuilder.Add(block); | 3592 | m_fullUpdateDataBlocksBuilder.Add(block); |
3549 | 3593 | // } | |
3550 | // string text = Util.FieldToString(outPacket.ObjectData[i].Text); | ||
3551 | // if (text.IndexOf("\n") >= 0) | ||
3552 | // text = text.Remove(text.IndexOf("\n")); | ||
3553 | // m_log.DebugFormat( | ||
3554 | // "[CLIENT]: Sending full info about prim {0} text {1} to client {2}", | ||
3555 | // outPacket.ObjectData[i].ID, text, Name); | ||
3556 | } | 3594 | } |
3557 | // else | 3595 | // else |
3558 | // { | 3596 | // { |
@@ -4504,6 +4542,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4504 | 4542 | ||
4505 | protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SendPrimitiveData data) | 4543 | protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SendPrimitiveData data) |
4506 | { | 4544 | { |
4545 | // if (data.attachment) | ||
4546 | // m_log.DebugFormat( | ||
4547 | // "[LLCLIENTVIEW]: Creating prim update block for {0}, parent {1}, priority {2}", | ||
4548 | // data.localID, data.parentID, data.priority); | ||
4549 | |||
4507 | byte[] objectData = new byte[60]; | 4550 | byte[] objectData = new byte[60]; |
4508 | data.pos.ToBytes(objectData, 0); | 4551 | data.pos.ToBytes(objectData, 0); |
4509 | data.vel.ToBytes(objectData, 12); | 4552 | data.vel.ToBytes(objectData, 12); |
@@ -7053,32 +7096,89 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7053 | taskID = new UUID(transfer.TransferInfo.Params, 48); | 7096 | taskID = new UUID(transfer.TransferInfo.Params, 48); |
7054 | UUID itemID = new UUID(transfer.TransferInfo.Params, 64); | 7097 | UUID itemID = new UUID(transfer.TransferInfo.Params, 64); |
7055 | UUID requestID = new UUID(transfer.TransferInfo.Params, 80); | 7098 | UUID requestID = new UUID(transfer.TransferInfo.Params, 80); |
7099 | |||
7100 | // m_log.DebugFormat( | ||
7101 | // "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}", | ||
7102 | // requestID, itemID, taskID, Name); | ||
7103 | |||
7056 | if (!(((Scene)m_scene).Permissions.BypassPermissions())) | 7104 | if (!(((Scene)m_scene).Permissions.BypassPermissions())) |
7057 | { | 7105 | { |
7058 | if (taskID != UUID.Zero) // Prim | 7106 | if (taskID != UUID.Zero) // Prim |
7059 | { | 7107 | { |
7060 | SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); | 7108 | SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); |
7061 | if (part == null) | 7109 | if (part == null) |
7110 | { | ||
7111 | m_log.WarnFormat( | ||
7112 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist", | ||
7113 | Name, requestID, itemID, taskID); | ||
7062 | return true; | 7114 | return true; |
7115 | } | ||
7063 | 7116 | ||
7064 | if (part.OwnerID != AgentId) | 7117 | TaskInventoryItem tii = part.Inventory.GetInventoryItem(itemID); |
7065 | return true; | 7118 | if (tii == null) |
7066 | 7119 | { | |
7067 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) | 7120 | m_log.WarnFormat( |
7068 | return true; | 7121 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist", |
7069 | 7122 | Name, requestID, itemID, taskID); | |
7070 | TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID); | ||
7071 | if (ti == null) | ||
7072 | return true; | ||
7073 | |||
7074 | if (ti.OwnerID != AgentId) | ||
7075 | return true; | ||
7076 | |||
7077 | if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) | ||
7078 | return true; | ||
7079 | |||
7080 | if (ti.AssetID != requestID) | ||
7081 | return true; | 7123 | return true; |
7124 | } | ||
7125 | |||
7126 | if (tii.Type == (int)AssetType.LSLText) | ||
7127 | { | ||
7128 | if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId)) | ||
7129 | return true; | ||
7130 | } | ||
7131 | else if (tii.Type == (int)AssetType.Notecard) | ||
7132 | { | ||
7133 | if (!((Scene)m_scene).Permissions.CanEditNotecard(itemID, taskID, AgentId)) | ||
7134 | return true; | ||
7135 | } | ||
7136 | else | ||
7137 | { | ||
7138 | // TODO: Change this code to allow items other than notecards and scripts to be successfully | ||
7139 | // shared with group. In fact, all this permissions checking should move to an IPermissionsModule | ||
7140 | if (part.OwnerID != AgentId) | ||
7141 | { | ||
7142 | m_log.WarnFormat( | ||
7143 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}", | ||
7144 | Name, requestID, itemID, taskID, part.OwnerID); | ||
7145 | return true; | ||
7146 | } | ||
7147 | |||
7148 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) | ||
7149 | { | ||
7150 | m_log.WarnFormat( | ||
7151 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set", | ||
7152 | Name, requestID, itemID, taskID); | ||
7153 | return true; | ||
7154 | } | ||
7155 | |||
7156 | if (tii.OwnerID != AgentId) | ||
7157 | { | ||
7158 | m_log.WarnFormat( | ||
7159 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}", | ||
7160 | Name, requestID, itemID, taskID, tii.OwnerID); | ||
7161 | return true; | ||
7162 | } | ||
7163 | |||
7164 | if (( | ||
7165 | tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) | ||
7166 | != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) | ||
7167 | { | ||
7168 | m_log.WarnFormat( | ||
7169 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer", | ||
7170 | Name, requestID, itemID, taskID); | ||
7171 | return true; | ||
7172 | } | ||
7173 | |||
7174 | if (tii.AssetID != requestID) | ||
7175 | { | ||
7176 | m_log.WarnFormat( | ||
7177 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}", | ||
7178 | Name, requestID, itemID, taskID, tii.AssetID); | ||
7179 | return true; | ||
7180 | } | ||
7181 | } | ||
7082 | } | 7182 | } |
7083 | else // Agent | 7183 | else // Agent |
7084 | { | 7184 | { |
@@ -7114,7 +7214,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7114 | } | 7214 | } |
7115 | 7215 | ||
7116 | if (assetRequestItem.AssetID != requestID) | 7216 | if (assetRequestItem.AssetID != requestID) |
7217 | { | ||
7218 | m_log.WarnFormat( | ||
7219 | "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}", | ||
7220 | Name, requestID, itemID, assetRequestItem.AssetID); | ||
7117 | return true; | 7221 | return true; |
7222 | } | ||
7118 | } | 7223 | } |
7119 | } | 7224 | } |
7120 | } | 7225 | } |
@@ -7661,12 +7766,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7661 | newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask; | 7766 | newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask; |
7662 | newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask; | 7767 | newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask; |
7663 | newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask; | 7768 | newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask; |
7769 | |||
7770 | // Unused? Clicking share with group sets GroupPermissions instead, so perhaps this is something | ||
7771 | // different | ||
7664 | //newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned; | 7772 | //newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned; |
7665 | newTaskItem.Type = updatetask.InventoryData.Type; | 7773 | newTaskItem.Type = updatetask.InventoryData.Type; |
7666 | newTaskItem.InvType = updatetask.InventoryData.InvType; | 7774 | newTaskItem.InvType = updatetask.InventoryData.InvType; |
7667 | newTaskItem.Flags = updatetask.InventoryData.Flags; | 7775 | newTaskItem.Flags = updatetask.InventoryData.Flags; |
7668 | //newTaskItem.SaleType=updatetask.InventoryData.SaleType; | 7776 | //newTaskItem.SaleType=updatetask.InventoryData.SaleType; |
7669 | //newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;; | 7777 | //newTaskItem.SalePrice=updatetask.InventoryData.SalePrice; |
7670 | newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name); | 7778 | newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name); |
7671 | newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description); | 7779 | newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description); |
7672 | newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate; | 7780 | newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate; |
@@ -7674,7 +7782,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7674 | newTaskItem, updatetask.UpdateData.LocalID); | 7782 | newTaskItem, updatetask.UpdateData.LocalID); |
7675 | } | 7783 | } |
7676 | } | 7784 | } |
7677 | } | 7785 | } |
7678 | 7786 | ||
7679 | return true; | 7787 | return true; |
7680 | } | 7788 | } |
@@ -10977,7 +11085,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10977 | LLUDPServer.LogPacketHeader(false, m_circuitCode, 0, packet.Type, (ushort)packet.Length); | 11085 | LLUDPServer.LogPacketHeader(false, m_circuitCode, 0, packet.Type, (ushort)packet.Length); |
10978 | #endregion BinaryStats | 11086 | #endregion BinaryStats |
10979 | 11087 | ||
10980 | m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true); | 11088 | OutPacket(packet, throttlePacketType, true); |
10981 | } | 11089 | } |
10982 | 11090 | ||
10983 | /// <summary> | 11091 | /// <summary> |
@@ -10990,6 +11098,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10990 | /// handles splitting manually</param> | 11098 | /// handles splitting manually</param> |
10991 | protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) | 11099 | protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) |
10992 | { | 11100 | { |
11101 | if (m_debugPacketLevel >= 255) | ||
11102 | m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); | ||
11103 | |||
10993 | m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); | 11104 | m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); |
10994 | } | 11105 | } |
10995 | 11106 | ||
@@ -11061,10 +11172,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11061 | /// <param name="Pack">OpenMetaverse.packet</param> | 11172 | /// <param name="Pack">OpenMetaverse.packet</param> |
11062 | public void ProcessInPacket(Packet Pack) | 11173 | public void ProcessInPacket(Packet Pack) |
11063 | { | 11174 | { |
11064 | // m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack); | 11175 | if (m_debugPacketLevel >= 255) |
11176 | m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); | ||
11065 | 11177 | ||
11066 | if (!ProcessPacketMethod(Pack)) | 11178 | if (!ProcessPacketMethod(Pack)) |
11067 | m_log.Warn("[CLIENT]: unhandled packet " + Pack); | 11179 | m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); |
11068 | 11180 | ||
11069 | PacketPool.Instance.ReturnPacket(Pack); | 11181 | PacketPool.Instance.ReturnPacket(Pack); |
11070 | } | 11182 | } |
@@ -11307,8 +11419,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11307 | // } | 11419 | // } |
11308 | } | 11420 | } |
11309 | 11421 | ||
11310 | //check to see if asset is in local cache, if not we need to request it from asset server. | 11422 | // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); |
11311 | //m_log.Debug("asset request " + requestID); | ||
11312 | 11423 | ||
11313 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); | 11424 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); |
11314 | 11425 | ||
@@ -11589,6 +11700,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11589 | public PacketMethod method; | 11700 | public PacketMethod method; |
11590 | public bool Async; | 11701 | public bool Async; |
11591 | } | 11702 | } |
11703 | |||
11592 | public class AsyncPacketProcess | 11704 | public class AsyncPacketProcess |
11593 | { | 11705 | { |
11594 | public bool result = false; | 11706 | public bool result = false; |
@@ -11631,4 +11743,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11631 | OutPacket(packet, ThrottleOutPacketType.Task); | 11743 | OutPacket(packet, ThrottleOutPacketType.Task); |
11632 | } | 11744 | } |
11633 | } | 11745 | } |
11634 | } | 11746 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs index d68c683..0730f8b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs | |||
@@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
260 | { | 260 | { |
261 | if (s.RegionInfo.RegionHandle == regionHandle) | 261 | if (s.RegionInfo.RegionHandle == regionHandle) |
262 | { | 262 | { |
263 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); | 263 | // m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); |
264 | if (isLocalCall) | 264 | if (isLocalCall) |
265 | { | 265 | { |
266 | // We need to make a local copy of the object | 266 | // We need to make a local copy of the object |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 212cfee..e11e23a 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -145,7 +145,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
145 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); | 145 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); |
146 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); | 146 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); |
147 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); | 147 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); |
148 | private IFriendsModule m_friendsModule = null; | 148 | private IFriendsModule m_friendsModule; |
149 | private IGroupsModule m_groupsModule; | ||
149 | 150 | ||
150 | #endregion | 151 | #endregion |
151 | 152 | ||
@@ -369,9 +370,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
369 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | 370 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); |
370 | 371 | ||
371 | if (m_friendsModule == null) | 372 | if (m_friendsModule == null) |
372 | m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work"); | 373 | m_log.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work"); |
373 | else | 374 | |
374 | m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled"); | 375 | m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); |
376 | |||
377 | if (m_groupsModule == null) | ||
378 | m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); | ||
375 | } | 379 | } |
376 | 380 | ||
377 | public void Close() | 381 | public void Close() |
@@ -406,15 +410,34 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
406 | // with the powers requested (powers = 0 for no powers check) | 410 | // with the powers requested (powers = 0 for no powers check) |
407 | protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) | 411 | protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) |
408 | { | 412 | { |
413 | //DateTime t1 = DateTime.Now; | ||
414 | bool result = false; | ||
415 | |||
409 | ScenePresence sp = m_scene.GetScenePresence(userID); | 416 | ScenePresence sp = m_scene.GetScenePresence(userID); |
410 | if (sp != null) | 417 | if (sp != null) |
411 | { | 418 | { |
412 | IClientAPI client = sp.ControllingClient; | 419 | IClientAPI client = sp.ControllingClient; |
413 | 420 | ||
414 | return ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) && | 421 | result = ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) && |
415 | ((powers == 0) || ((client.ActiveGroupPowers & powers) == powers))); | 422 | ((powers == 0) || ((client.ActiveGroupPowers & powers) == powers))); |
416 | } | 423 | } |
417 | return false; | 424 | |
425 | /* | ||
426 | if (null != m_groupsModule) | ||
427 | { | ||
428 | GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID); | ||
429 | |||
430 | if (gmd != null) | ||
431 | { | ||
432 | if (((gmd.GroupPowers != 0) && powers == 0) || (gmd.GroupPowers & powers) == powers) | ||
433 | result = true; | ||
434 | } | ||
435 | } | ||
436 | */ | ||
437 | |||
438 | //m_log.DebugFormat("[PERMISSIONS]: Group member check took {0}", (DateTime.Now - t1).TotalMilliseconds); | ||
439 | |||
440 | return result; | ||
418 | } | 441 | } |
419 | 442 | ||
420 | /// <summary> | 443 | /// <summary> |
@@ -704,8 +727,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
704 | permission = false; | 727 | permission = false; |
705 | } | 728 | } |
706 | 729 | ||
730 | // m_log.DebugFormat( | ||
731 | // "[PERMISSIONS]: group.GroupID = {0}, part.GroupMask = {1}, isGroupMember = {2} for {3}", | ||
732 | // group.GroupID, | ||
733 | // m_scene.GetSceneObjectPart(objId).GroupMask, | ||
734 | // IsGroupMember(group.GroupID, currentUser, 0), | ||
735 | // currentUser); | ||
736 | |||
707 | // Group members should be able to edit group objects | 737 | // Group members should be able to edit group objects |
708 | if ((group.GroupID != UUID.Zero) && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0) && IsGroupMember(group.GroupID, currentUser, 0)) | 738 | if ((group.GroupID != UUID.Zero) |
739 | && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0) | ||
740 | && IsGroupMember(group.GroupID, currentUser, 0)) | ||
709 | { | 741 | { |
710 | // Return immediately, so that the administrator can shares group objects | 742 | // Return immediately, so that the administrator can shares group objects |
711 | return true; | 743 | return true; |
@@ -940,7 +972,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
940 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 972 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
941 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 973 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
942 | 974 | ||
943 | |||
944 | return GenericObjectPermission(editorID, objectID, false); | 975 | return GenericObjectPermission(editorID, objectID, false); |
945 | } | 976 | } |
946 | 977 | ||
@@ -1047,7 +1078,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1047 | 1078 | ||
1048 | if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) | 1079 | if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) |
1049 | return false; | 1080 | return false; |
1050 | } else { | 1081 | } |
1082 | else | ||
1083 | { | ||
1051 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) | 1084 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) |
1052 | return false; | 1085 | return false; |
1053 | } | 1086 | } |
@@ -1063,7 +1096,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1063 | return false; | 1096 | return false; |
1064 | 1097 | ||
1065 | if (!IsGroupMember(ti.GroupID, user, 0)) | 1098 | if (!IsGroupMember(ti.GroupID, user, 0)) |
1066 | return false; | 1099 | return false; |
1067 | } | 1100 | } |
1068 | 1101 | ||
1069 | // Require full perms | 1102 | // Require full perms |
@@ -1470,14 +1503,16 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1470 | if (part.OwnerID != user) | 1503 | if (part.OwnerID != user) |
1471 | { | 1504 | { |
1472 | if (part.GroupID == UUID.Zero) | 1505 | if (part.GroupID == UUID.Zero) |
1473 | return false; | 1506 | return false; |
1474 | 1507 | ||
1475 | if (!IsGroupMember(part.GroupID, user, 0)) | 1508 | if (!IsGroupMember(part.GroupID, user, 0)) |
1476 | return false; | 1509 | return false; |
1477 | 1510 | ||
1478 | if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) | 1511 | if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) |
1479 | return false; | 1512 | return false; |
1480 | } else { | 1513 | } |
1514 | else | ||
1515 | { | ||
1481 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) | 1516 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) |
1482 | return false; | 1517 | return false; |
1483 | } | 1518 | } |
@@ -1732,7 +1767,69 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1732 | return GenericObjectPermission(agentID, prim, false); | 1767 | return GenericObjectPermission(agentID, prim, false); |
1733 | } | 1768 | } |
1734 | 1769 | ||
1735 | private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) { | 1770 | private bool CanUseObjectReturn(ILandObject parcel, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene) |
1771 | { | ||
1772 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
1773 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
1774 | |||
1775 | long powers = 0; | ||
1776 | if (parcel.LandData.GroupID != UUID.Zero) | ||
1777 | client.GetGroupPowers(parcel.LandData.GroupID); | ||
1778 | |||
1779 | switch (type) | ||
1780 | { | ||
1781 | case (uint)ObjectReturnType.Owner: | ||
1782 | // Don't let group members return owner's objects, ever | ||
1783 | // | ||
1784 | if (parcel.LandData.IsGroupOwned) | ||
1785 | { | ||
1786 | if ((powers & (long)GroupPowers.ReturnGroupOwned) != 0) | ||
1787 | return true; | ||
1788 | } | ||
1789 | else | ||
1790 | { | ||
1791 | if (parcel.LandData.OwnerID != client.AgentId) | ||
1792 | return false; | ||
1793 | } | ||
1794 | return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupOwned); | ||
1795 | case (uint)ObjectReturnType.Group: | ||
1796 | if (parcel.LandData.OwnerID != client.AgentId) | ||
1797 | { | ||
1798 | // If permissionis granted through a group... | ||
1799 | // | ||
1800 | if ((powers & (long)GroupPowers.ReturnGroupSet) != 0) | ||
1801 | { | ||
1802 | foreach (SceneObjectGroup g in new List<SceneObjectGroup>(retlist)) | ||
1803 | { | ||
1804 | // check for and remove group owned objects unless | ||
1805 | // the user also has permissions to return those | ||
1806 | // | ||
1807 | if (g.OwnerID == g.GroupID && | ||
1808 | ((powers & (long)GroupPowers.ReturnGroupOwned) == 0)) | ||
1809 | { | ||
1810 | retlist.Remove(g); | ||
1811 | } | ||
1812 | } | ||
1813 | // And allow the operation | ||
1814 | // | ||
1815 | return true; | ||
1816 | } | ||
1817 | } | ||
1818 | return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupSet); | ||
1819 | case (uint)ObjectReturnType.Other: | ||
1820 | if ((powers & (long)GroupPowers.ReturnNonGroup) != 0) | ||
1821 | return true; | ||
1822 | return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnNonGroup); | ||
1823 | case (uint)ObjectReturnType.List: | ||
1824 | break; | ||
1825 | } | ||
1826 | |||
1827 | return GenericParcelOwnerPermission(client.AgentId, parcel, 0); | ||
1828 | // Is it correct to be less restrictive for lists of objects to be returned? | ||
1829 | } | ||
1830 | |||
1831 | private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) | ||
1832 | { | ||
1736 | //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); | 1833 | //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); |
1737 | switch (scriptType) { | 1834 | switch (scriptType) { |
1738 | case 0: | 1835 | case 0: |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index cedf405..2aad4f0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1225,6 +1225,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1225 | item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); | 1225 | item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); |
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | // If we've found the item in the user's inventory or in the library | ||
1228 | if (item != null) | 1229 | if (item != null) |
1229 | { | 1230 | { |
1230 | part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); | 1231 | part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); |
@@ -2458,6 +2459,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2458 | return; | 2459 | return; |
2459 | } | 2460 | } |
2460 | 2461 | ||
2462 | // m_log.DebugFormat("[SCENE INVENTORY]: {0} {1} IsAttachment={2}", att.Name, att.LocalId, att.IsAttachment); | ||
2463 | // Console.WriteLine("HERE X"); | ||
2461 | ScenePresence presence; | 2464 | ScenePresence presence; |
2462 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | 2465 | if (TryGetAvatar(remoteClient.AgentId, out presence)) |
2463 | { | 2466 | { |
@@ -2465,9 +2468,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2465 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 2468 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
2466 | item = InventoryService.GetItem(item); | 2469 | item = InventoryService.GetItem(item); |
2467 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | 2470 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); |
2471 | // Console.WriteLine("HERE Y"); | ||
2468 | 2472 | ||
2469 | if (m_AvatarFactory != null) | 2473 | if (m_AvatarFactory != null) |
2470 | m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 2474 | m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); |
2475 | |||
2476 | // Console.WriteLine("HERE Z"); | ||
2471 | } | 2477 | } |
2472 | } | 2478 | } |
2473 | 2479 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ac04dc7..869efd7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -116,6 +116,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
116 | /// <param name="remoteClient"></param> | 116 | /// <param name="remoteClient"></param> |
117 | public void RequestPrim(uint primLocalID, IClientAPI remoteClient) | 117 | public void RequestPrim(uint primLocalID, IClientAPI remoteClient) |
118 | { | 118 | { |
119 | // m_log.DebugFormat("[SCENE]: {0} requested full update for {1}", remoteClient.Name, primLocalID); | ||
120 | |||
119 | List<EntityBase> EntityList = GetEntities(); | 121 | List<EntityBase> EntityList = GetEntities(); |
120 | 122 | ||
121 | foreach (EntityBase ent in EntityList) | 123 | foreach (EntityBase ent in EntityList) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4bd3222..221eb47 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1891,9 +1891,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
1891 | /// true if the object was added, false if an object with the same uuid was already in the scene | 1891 | /// true if the object was added, false if an object with the same uuid was already in the scene |
1892 | /// </returns> | 1892 | /// </returns> |
1893 | public bool AddRestoredSceneObject( | 1893 | public bool AddRestoredSceneObject( |
1894 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | ||
1895 | { | ||
1896 | return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); | ||
1897 | } | ||
1898 | |||
1899 | /// <summary> | ||
1900 | /// Add an object into the scene that has come from storage | ||
1901 | /// </summary> | ||
1902 | /// | ||
1903 | /// <param name="sceneObject"></param> | ||
1904 | /// <param name="attachToBackup"> | ||
1905 | /// If true, changes to the object will be reflected in its persisted data | ||
1906 | /// If false, the persisted data will not be changed even if the object in the scene is changed | ||
1907 | /// </param> | ||
1908 | /// <param name="alreadyPersisted"> | ||
1909 | /// If true, we won't persist this object until it changes | ||
1910 | /// If false, we'll persist this object immediately | ||
1911 | /// </param> | ||
1912 | /// <returns> | ||
1913 | /// true if the object was added, false if an object with the same uuid was already in the scene | ||
1914 | /// </returns> | ||
1915 | public bool AddRestoredSceneObject( | ||
1894 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) | 1916 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) |
1895 | { | 1917 | { |
1896 | return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted); | 1918 | return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true); |
1897 | } | 1919 | } |
1898 | 1920 | ||
1899 | /// <summary> | 1921 | /// <summary> |
@@ -2506,7 +2528,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2506 | /// <returns></returns> | 2528 | /// <returns></returns> |
2507 | public bool IncomingCreateObject(ISceneObject sog) | 2529 | public bool IncomingCreateObject(ISceneObject sog) |
2508 | { | 2530 | { |
2509 | //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); | 2531 | // m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); |
2510 | SceneObjectGroup newObject; | 2532 | SceneObjectGroup newObject; |
2511 | try | 2533 | try |
2512 | { | 2534 | { |
@@ -2578,10 +2600,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2578 | 2600 | ||
2579 | if (sceneObject.IsAttachmentCheckFull()) // Attachment | 2601 | if (sceneObject.IsAttachmentCheckFull()) // Attachment |
2580 | { | 2602 | { |
2603 | // m_log.DebugFormat("[SCENE]: Adding attachment {0} {1}", sceneObject.Name, sceneObject.LocalId); | ||
2604 | |||
2581 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); | 2605 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); |
2582 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); | 2606 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); |
2583 | 2607 | ||
2584 | AddRestoredSceneObject(sceneObject, false, false); | 2608 | AddRestoredSceneObject(sceneObject, false, false, false); |
2585 | 2609 | ||
2586 | // Handle attachment special case | 2610 | // Handle attachment special case |
2587 | SceneObjectPart RootPrim = sceneObject.RootPart; | 2611 | SceneObjectPart RootPrim = sceneObject.RootPart; |
@@ -2589,6 +2613,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2589 | // Fix up attachment Parent Local ID | 2613 | // Fix up attachment Parent Local ID |
2590 | ScenePresence sp = GetScenePresence(sceneObject.OwnerID); | 2614 | ScenePresence sp = GetScenePresence(sceneObject.OwnerID); |
2591 | 2615 | ||
2616 | // Console.WriteLine("AAAA"); | ||
2617 | |||
2592 | //uint parentLocalID = 0; | 2618 | //uint parentLocalID = 0; |
2593 | if (sp != null) | 2619 | if (sp != null) |
2594 | { | 2620 | { |
@@ -2607,20 +2633,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2607 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); | 2633 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); |
2608 | m_log.DebugFormat( | 2634 | m_log.DebugFormat( |
2609 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); | 2635 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2610 | 2636 | ||
2637 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | ||
2611 | AttachObject( | 2638 | AttachObject( |
2612 | sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); | 2639 | sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); |
2613 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2640 | |
2614 | grp.SendGroupFullUpdate(); | 2641 | //grp.SendGroupFullUpdate(); |
2615 | } | 2642 | } |
2616 | else | 2643 | else |
2617 | { | 2644 | { |
2618 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2645 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2619 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2646 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2620 | } | 2647 | } |
2648 | |||
2649 | // Console.WriteLine("BBBB"); | ||
2621 | } | 2650 | } |
2622 | else | 2651 | else |
2623 | { | 2652 | { |
2653 | // m_log.DebugFormat("[SCENE]: Adding ordinary object {0} {1}", sceneObject.Name, sceneObject.LocalId); | ||
2654 | |||
2624 | AddRestoredSceneObject(sceneObject, true, false); | 2655 | AddRestoredSceneObject(sceneObject, true, false); |
2625 | 2656 | ||
2626 | if (!Permissions.CanObjectEntry(sceneObject.UUID, | 2657 | if (!Permissions.CanObjectEntry(sceneObject.UUID, |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 04626d3..1ba1953 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -1410,7 +1410,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1410 | // now we have a child agent in this region. Request all interesting data about other (root) agents | 1410 | // now we have a child agent in this region. Request all interesting data about other (root) agents |
1411 | agent.SendInitialFullUpdateToAllClients(); | 1411 | agent.SendInitialFullUpdateToAllClients(); |
1412 | 1412 | ||
1413 | // Console.WriteLine("SCS 1"); | ||
1413 | agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true); | 1414 | agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true); |
1415 | // Console.WriteLine("SCS 2"); | ||
1414 | 1416 | ||
1415 | // m_scene.SendKillObject(m_localId); | 1417 | // m_scene.SendKillObject(m_localId); |
1416 | 1418 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 730ec31..5a1922a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -216,11 +216,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
216 | /// If true, we won't persist this object until it changes | 216 | /// If true, we won't persist this object until it changes |
217 | /// If false, we'll persist this object immediately | 217 | /// If false, we'll persist this object immediately |
218 | /// </param> | 218 | /// </param> |
219 | /// <param name="sendClientUpdate"> | ||
220 | /// If true, we send updates to the client to tell it about this object | ||
221 | /// If false, we leave it up to the caller to do this | ||
222 | /// </param> | ||
219 | /// <returns> | 223 | /// <returns> |
220 | /// true if the object was added, false if an object with the same uuid was already in the scene | 224 | /// true if the object was added, false if an object with the same uuid was already in the scene |
221 | /// </returns> | 225 | /// </returns> |
222 | protected internal bool AddRestoredSceneObject( | 226 | protected internal bool AddRestoredSceneObject( |
223 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) | 227 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
224 | { | 228 | { |
225 | // KF: Check for out-of-region, move inside and make static. | 229 | // KF: Check for out-of-region, move inside and make static. |
226 | Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, | 230 | Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, |
@@ -252,8 +256,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
252 | sceneObject.HasGroupChanged = true; | 256 | sceneObject.HasGroupChanged = true; |
253 | } | 257 | } |
254 | 258 | ||
255 | return AddSceneObject(sceneObject, attachToBackup, true); | 259 | return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); |
256 | } | 260 | } |
261 | |||
262 | // /// <summary> | ||
263 | // /// Add an object into the scene that has come from storage | ||
264 | // /// </summary> | ||
265 | // /// <param name="sceneObject"></param> | ||
266 | // /// <param name="attachToBackup"> | ||
267 | // /// If true, changes to the object will be reflected in its persisted data | ||
268 | // /// If false, the persisted data will not be changed even if the object in the scene is changed | ||
269 | // /// </param> | ||
270 | // /// <param name="alreadyPersisted"> | ||
271 | // /// If true, we won't persist this object until it changes | ||
272 | // /// If false, we'll persist this object immediately | ||
273 | // /// </param> | ||
274 | // /// <returns> | ||
275 | // /// true if the object was added, false if an object with the same uuid was already in the scene | ||
276 | // /// </returns> | ||
277 | // protected internal bool AddRestoredSceneObject( | ||
278 | // SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) | ||
279 | // { | ||
280 | // AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true); | ||
281 | // } | ||
257 | 282 | ||
258 | /// <summary> | 283 | /// <summary> |
259 | /// Add a newly created object to the scene. This will both update the scene, and send information about the | 284 | /// 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 | |||
647 | protected internal bool AttachObject( | 672 | protected internal bool AttachObject( |
648 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) | 673 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) |
649 | { | 674 | { |
675 | // Console.WriteLine("HERE A"); | ||
650 | SceneObjectGroup group = GetGroupByPrim(objectLocalID); | 676 | SceneObjectGroup group = GetGroupByPrim(objectLocalID); |
651 | if (group != null) | 677 | if (group != null) |
652 | { | 678 | { |
653 | if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) | 679 | if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) |
654 | { | 680 | { |
681 | // Console.WriteLine("HERE -1"); | ||
655 | // If the attachment point isn't the same as the one previously used | 682 | // If the attachment point isn't the same as the one previously used |
656 | // set it's offset position = 0 so that it appears on the attachment point | 683 | // set it's offset position = 0 so that it appears on the attachment point |
657 | // and not in a weird location somewhere unknown. | 684 | // and not in a weird location somewhere unknown. |
@@ -690,9 +717,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
690 | itemId = group.GetFromItemID(); | 717 | itemId = group.GetFromItemID(); |
691 | } | 718 | } |
692 | 719 | ||
720 | // Console.WriteLine("HERE 0"); | ||
693 | m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); | 721 | m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); |
694 | 722 | ||
723 | // Console.WriteLine("HERE 1"); | ||
695 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); | 724 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); |
725 | // Console.WriteLine("HERE 2"); | ||
696 | // In case it is later dropped again, don't let | 726 | // In case it is later dropped again, don't let |
697 | // it get cleaned up | 727 | // it get cleaned up |
698 | // | 728 | // |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index c2e3370..92c278e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -422,7 +422,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
422 | 422 | ||
423 | if (!scenePresence.IsChildAgent) | 423 | if (!scenePresence.IsChildAgent) |
424 | { | 424 | { |
425 | m_log.ErrorFormat("Packet debug for {0} {1} set to {2}", | 425 | m_log.DebugFormat("Packet debug for {0} {1} set to {2}", |
426 | scenePresence.Firstname, | 426 | scenePresence.Firstname, |
427 | scenePresence.Lastname, | 427 | scenePresence.Lastname, |
428 | newDebug); | 428 | newDebug); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 8b58b3e..8b65445 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -171,7 +171,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
171 | item.NextPermissions; | 171 | item.NextPermissions; |
172 | taskItem.NextPermissions = item.NextPermissions; | 172 | taskItem.NextPermissions = item.NextPermissions; |
173 | taskItem.CurrentPermissions |= 8; | 173 | taskItem.CurrentPermissions |= 8; |
174 | } else { | 174 | } |
175 | else | ||
176 | { | ||
175 | taskItem.BasePermissions = item.BasePermissions; | 177 | taskItem.BasePermissions = item.BasePermissions; |
176 | taskItem.CurrentPermissions = item.CurrentPermissions; | 178 | taskItem.CurrentPermissions = item.CurrentPermissions; |
177 | taskItem.CurrentPermissions |= 8; | 179 | taskItem.CurrentPermissions |= 8; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index edaf1a0..93f45e0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1651,6 +1651,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1651 | 1651 | ||
1652 | public void SendFullUpdateToClient(IClientAPI remoteClient) | 1652 | public void SendFullUpdateToClient(IClientAPI remoteClient) |
1653 | { | 1653 | { |
1654 | // if (IsAttachment) | ||
1655 | // m_log.DebugFormat( | ||
1656 | // "[SOG]: Sending full update to client {0} for {1} {2}", remoteClient.Name, Name, LocalId); | ||
1657 | |||
1654 | SendPartFullUpdate(remoteClient, RootPart, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID)); | 1658 | SendPartFullUpdate(remoteClient, RootPart, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID)); |
1655 | 1659 | ||
1656 | lockPartsForRead(true); | 1660 | lockPartsForRead(true); |
@@ -1673,8 +1677,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1673 | /// <param name="part"></param> | 1677 | /// <param name="part"></param> |
1674 | internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) | 1678 | internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) |
1675 | { | 1679 | { |
1676 | // m_log.DebugFormat( | 1680 | // if (IsAttachment) |
1677 | // "[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); | 1681 | // m_log.DebugFormat( |
1682 | // "[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); | ||
1678 | 1683 | ||
1679 | if (m_rootPart.UUID == part.UUID) | 1684 | if (m_rootPart.UUID == part.UUID) |
1680 | { | 1685 | { |
@@ -2186,7 +2191,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2186 | 2191 | ||
2187 | public void ScheduleFullUpdateToAvatar(ScenePresence presence) | 2192 | public void ScheduleFullUpdateToAvatar(ScenePresence presence) |
2188 | { | 2193 | { |
2189 | // m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1} just to avatar {2}", Name, UUID, presence.Name); | 2194 | // if (IsAttachment) |
2195 | // m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1} just to avatar {2}", Name, UUID, presence.Name); | ||
2190 | 2196 | ||
2191 | RootPart.AddFullUpdateToAvatar(presence); | 2197 | RootPart.AddFullUpdateToAvatar(presence); |
2192 | 2198 | ||
@@ -2222,7 +2228,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2222 | /// </summary> | 2228 | /// </summary> |
2223 | public void ScheduleGroupForFullUpdate() | 2229 | public void ScheduleGroupForFullUpdate() |
2224 | { | 2230 | { |
2225 | // m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, UUID); | 2231 | // if (IsAttachment) |
2232 | // m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId); | ||
2226 | 2233 | ||
2227 | checkAtTargets(); | 2234 | checkAtTargets(); |
2228 | RootPart.ScheduleFullUpdate(); | 2235 | RootPart.ScheduleFullUpdate(); |
@@ -2265,7 +2272,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2265 | if (IsDeleted) | 2272 | if (IsDeleted) |
2266 | return; | 2273 | return; |
2267 | 2274 | ||
2268 | // m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID); | 2275 | // m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, LocalId); |
2269 | 2276 | ||
2270 | RootPart.SendFullUpdateToAllClients(); | 2277 | RootPart.SendFullUpdateToAllClients(); |
2271 | 2278 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 548a64f..9862785 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1270,16 +1270,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1270 | /// Tell all scene presences that they should send updates for this part to their clients | 1270 | /// Tell all scene presences that they should send updates for this part to their clients |
1271 | /// </summary> | 1271 | /// </summary> |
1272 | public void AddFullUpdateToAllAvatars() | 1272 | public void AddFullUpdateToAllAvatars() |
1273 | { | 1273 | { |
1274 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); | 1274 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
1275 | for (int i = 0; i < avatars.Length; i++) | 1275 | for (int i = 0; i < avatars.Length; i++) |
1276 | { | 1276 | AddFullUpdateToAvatar(avatars[i]); |
1277 | avatars[i].SceneViewer.QueuePartForUpdate(this); | ||
1278 | } | ||
1279 | } | 1277 | } |
1280 | 1278 | ||
1281 | public void AddFullUpdateToAvatar(ScenePresence presence) | 1279 | public void AddFullUpdateToAvatar(ScenePresence presence) |
1282 | { | 1280 | { |
1281 | // if (IsAttachment) | ||
1282 | // m_log.DebugFormat("AddFullUpdateToAllAvatar() {0} for {1} {2}", presence.Name, Name, LocalId); | ||
1283 | |||
1283 | presence.SceneViewer.QueuePartForUpdate(this); | 1284 | presence.SceneViewer.QueuePartForUpdate(this); |
1284 | } | 1285 | } |
1285 | 1286 | ||
@@ -1298,13 +1299,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1298 | { | 1299 | { |
1299 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); | 1300 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
1300 | for (int i = 0; i < avatars.Length; i++) | 1301 | for (int i = 0; i < avatars.Length; i++) |
1301 | { | 1302 | AddTerseUpdateToAvatar(avatars[i]); |
1302 | avatars[i].SceneViewer.QueuePartForUpdate(this); | ||
1303 | } | ||
1304 | } | 1303 | } |
1305 | 1304 | ||
1306 | public void AddTerseUpdateToAvatar(ScenePresence presence) | 1305 | public void AddTerseUpdateToAvatar(ScenePresence presence) |
1307 | { | 1306 | { |
1307 | // if (IsAttachment) | ||
1308 | // m_log.DebugFormat("AddTerseUpdateToAvatar() {0} for {1} {2}", presence.Name, Name, LocalId); | ||
1309 | |||
1308 | presence.SceneViewer.QueuePartForUpdate(this); | 1310 | presence.SceneViewer.QueuePartForUpdate(this); |
1309 | } | 1311 | } |
1310 | 1312 | ||
@@ -2713,7 +2715,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2713 | /// </summary> | 2715 | /// </summary> |
2714 | public void ScheduleFullUpdate() | 2716 | public void ScheduleFullUpdate() |
2715 | { | 2717 | { |
2716 | // m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); | 2718 | // if (IsAttachment) |
2719 | // m_log.DebugFormat("[SOP]: Scheduling full update for {0} {1}", Name, LocalId); | ||
2717 | 2720 | ||
2718 | if (m_parentGroup != null) | 2721 | if (m_parentGroup != null) |
2719 | { | 2722 | { |
@@ -2826,6 +2829,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2826 | /// <param name="remoteClient"></param> | 2829 | /// <param name="remoteClient"></param> |
2827 | public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) | 2830 | public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) |
2828 | { | 2831 | { |
2832 | // if (IsAttachment) | ||
2833 | // m_log.DebugFormat( | ||
2834 | // "[SCENE OBJECT PART]: Sending part full update to {0} for {1} {2}", remoteClient.Name, Name, LocalId); | ||
2835 | |||
2829 | m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); | 2836 | m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); |
2830 | } | 2837 | } |
2831 | 2838 | ||
@@ -2834,6 +2841,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2834 | /// </summary> | 2841 | /// </summary> |
2835 | public void SendFullUpdateToAllClients() | 2842 | public void SendFullUpdateToAllClients() |
2836 | { | 2843 | { |
2844 | // if (IsAttachment) | ||
2845 | // m_log.DebugFormat( | ||
2846 | // "[SCENE OBJECT PART]: Sending full update for {0} {1} for all clients", Name, LocalId); | ||
2847 | |||
2837 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); | 2848 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
2838 | for (int i = 0; i < avatars.Length; i++) | 2849 | for (int i = 0; i < avatars.Length; i++) |
2839 | { | 2850 | { |
@@ -2845,6 +2856,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2845 | 2856 | ||
2846 | public void SendFullUpdateToAllClientsExcept(UUID agentID) | 2857 | public void SendFullUpdateToAllClientsExcept(UUID agentID) |
2847 | { | 2858 | { |
2859 | // if (IsAttachment) | ||
2860 | // m_log.DebugFormat( | ||
2861 | // "[SCENE OBJECT PART]: Sending full update for {0} {1} to all clients except {2}", Name, LocalId, agentID); | ||
2862 | |||
2848 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); | 2863 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
2849 | for (int i = 0; i < avatars.Length; i++) | 2864 | for (int i = 0; i < avatars.Length; i++) |
2850 | { | 2865 | { |
@@ -2900,10 +2915,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2900 | //isattachment = ParentGroup.RootPart.IsAttachment; | 2915 | //isattachment = ParentGroup.RootPart.IsAttachment; |
2901 | 2916 | ||
2902 | byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; | 2917 | byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; |
2903 | remoteClient.SendPrimitiveToClient(new SendPrimitiveData(m_regionHandle, m_parentGroup.GetTimeDilation(), LocalId, m_shape, | 2918 | |
2904 | lPos, Velocity, Acceleration, RotationOffset, AngularVelocity, clientFlags, m_uuid, _ownerID, | 2919 | double priority = ParentGroup.GetUpdatePriority(remoteClient); |
2905 | m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment, | 2920 | if (IsRoot && IsAttachment) |
2906 | AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, ParentGroup.GetUpdatePriority(remoteClient))); | 2921 | { |
2922 | if (double.MinValue == priority) | ||
2923 | { | ||
2924 | m_log.WarnFormat( | ||
2925 | "[SOP]: Couldn't raise update priority of root part for attachment {0} {1} because priority is already highest value", | ||
2926 | Name, LocalId); | ||
2927 | } | ||
2928 | else | ||
2929 | { | ||
2930 | priority = double.MinValue; | ||
2931 | } | ||
2932 | } | ||
2933 | |||
2934 | remoteClient.SendPrimitiveToClient( | ||
2935 | new SendPrimitiveData(m_regionHandle, m_parentGroup.GetTimeDilation(), LocalId, m_shape, | ||
2936 | lPos, Velocity, Acceleration, RotationOffset, AngularVelocity, clientFlags, m_uuid, _ownerID, | ||
2937 | m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment, | ||
2938 | AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, priority)); | ||
2907 | } | 2939 | } |
2908 | 2940 | ||
2909 | /// <summary> | 2941 | /// <summary> |
@@ -2953,6 +2985,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2953 | { | 2985 | { |
2954 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 2986 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
2955 | { | 2987 | { |
2988 | // if (IsAttachment) | ||
2989 | // m_log.DebugFormat("[SOP]: Sending scheduled full update for {0} {1}", Name, LocalId); | ||
2990 | |||
2956 | AddFullUpdateToAllAvatars(); | 2991 | AddFullUpdateToAllAvatars(); |
2957 | m_updateFlag = 0; //Same here | 2992 | m_updateFlag = 0; //Same here |
2958 | } | 2993 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index a2fceb7..9b16281 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -31,6 +31,7 @@ using System.IO; | |||
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Collections; | 32 | using System.Collections; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Threading; | ||
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using log4net; | 36 | using log4net; |
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
@@ -209,6 +210,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
209 | if ((int)InventoryType.LSL == item.InvType) | 210 | if ((int)InventoryType.LSL == item.InvType) |
210 | { | 211 | { |
211 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); | 212 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); |
213 | if ((int)InventoryType.LSL == item.InvType) | ||
214 | { | ||
215 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); | ||
216 | Thread.Sleep(10); // workaround for Mono cpu utilization > 100% bug | ||
217 | } | ||
212 | } | 218 | } |
213 | } | 219 | } |
214 | } | 220 | } |
@@ -269,7 +275,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
269 | // m_log.InfoFormat( | 275 | // m_log.InfoFormat( |
270 | // "[PRIM INVENTORY]: " + | 276 | // "[PRIM INVENTORY]: " + |
271 | // "Starting script {0}, {1} in prim {2}, {3}", | 277 | // "Starting script {0}, {1} in prim {2}, {3}", |
272 | // item.Name, item.ItemID, Name, UUID); | 278 | // item.Name, item.ItemID, m_part.Name, m_part.UUID); |
273 | 279 | ||
274 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) | 280 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) |
275 | { | 281 | { |
@@ -654,6 +660,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
654 | item.ParentID = m_part.UUID; | 660 | item.ParentID = m_part.UUID; |
655 | item.ParentPartID = m_part.UUID; | 661 | item.ParentPartID = m_part.UUID; |
656 | item.Name = name; | 662 | item.Name = name; |
663 | item.GroupID = m_part.GroupID; | ||
657 | 664 | ||
658 | m_items.LockItemsForWrite(true); | 665 | m_items.LockItemsForWrite(true); |
659 | m_items.Add(item.ItemID, item); | 666 | m_items.Add(item.ItemID, item); |
@@ -743,6 +750,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
743 | item.ParentID = m_part.UUID; | 750 | item.ParentID = m_part.UUID; |
744 | item.ParentPartID = m_part.UUID; | 751 | item.ParentPartID = m_part.UUID; |
745 | item.Flags = m_items[item.ItemID].Flags; | 752 | item.Flags = m_items[item.ItemID].Flags; |
753 | // If group permissions have been set on, check that the groupID is up to date in case it has | ||
754 | // changed since permissions were last set. | ||
755 | if (item.GroupPermissions != (uint)PermissionMask.None) | ||
756 | item.GroupID = m_part.GroupID; | ||
757 | |||
746 | if (item.AssetID == UUID.Zero) | 758 | if (item.AssetID == UUID.Zero) |
747 | { | 759 | { |
748 | item.AssetID = m_items[item.ItemID].AssetID; | 760 | item.AssetID = m_items[item.ItemID].AssetID; |
@@ -896,6 +908,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
896 | uint everyoneMask = 0; | 908 | uint everyoneMask = 0; |
897 | uint baseMask = item.BasePermissions; | 909 | uint baseMask = item.BasePermissions; |
898 | uint ownerMask = item.CurrentPermissions; | 910 | uint ownerMask = item.CurrentPermissions; |
911 | uint groupMask = item.GroupPermissions; | ||
899 | 912 | ||
900 | invString.AddItemStart(); | 913 | invString.AddItemStart(); |
901 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); | 914 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); |
@@ -905,7 +918,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
905 | 918 | ||
906 | invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); | 919 | invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); |
907 | invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); | 920 | invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); |
908 | invString.AddNameValueLine("group_mask", Utils.UIntToHexString(0)); | 921 | invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); |
909 | invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); | 922 | invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); |
910 | invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); | 923 | invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); |
911 | 924 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 68acabe..a187844 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -885,7 +885,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
885 | if (!(pos.Y < 0)) | 885 | if (!(pos.Y < 0)) |
886 | emergencyPos.Y = pos.Y; | 886 | emergencyPos.Y = pos.Y; |
887 | if (!(pos.Z < 0)) | 887 | if (!(pos.Z < 0)) |
888 | emergencyPos.X = pos.X; | 888 | emergencyPos.Z = pos.Z; |
889 | } | 889 | } |
890 | if (pos.Y < 0) | 890 | if (pos.Y < 0) |
891 | { | 891 | { |
@@ -903,7 +903,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
903 | emergencyPos.Y = pos.Y; | 903 | emergencyPos.Y = pos.Y; |
904 | //Leave as 128 | 904 | //Leave as 128 |
905 | } | 905 | } |
906 | 906 | ||
907 | m_log.WarnFormat( | 907 | m_log.WarnFormat( |
908 | "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", | 908 | "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", |
909 | pos, Name, UUID, emergencyPos); | 909 | pos, Name, UUID, emergencyPos); |
@@ -4103,6 +4103,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4103 | 4103 | ||
4104 | private double UpdatePriority(UpdatePriorityData data) | 4104 | private double UpdatePriority(UpdatePriorityData data) |
4105 | { | 4105 | { |
4106 | // m_log.DebugFormat("[SCENE PRESENCE]: Reprioritizing updates to client {0} for {1}", Name, data.localID); | ||
4107 | |||
4106 | EntityBase entity; | 4108 | EntityBase entity; |
4107 | SceneObjectGroup group; | 4109 | SceneObjectGroup group; |
4108 | 4110 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index 1cff0eb..9799872 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | ||
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
31 | using log4net; | 32 | using log4net; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
@@ -39,6 +40,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
39 | { | 40 | { |
40 | public class SceneViewer : ISceneViewer | 41 | public class SceneViewer : ISceneViewer |
41 | { | 42 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
42 | protected ScenePresence m_presence; | 45 | protected ScenePresence m_presence; |
43 | protected UpdateQueue m_partsUpdateQueue = new UpdateQueue(); | 46 | protected UpdateQueue m_partsUpdateQueue = new UpdateQueue(); |
44 | protected Queue<SceneObjectGroup> m_pendingObjects; | 47 | protected Queue<SceneObjectGroup> m_pendingObjects; |
@@ -60,6 +63,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
60 | /// <param name="part"></param> | 63 | /// <param name="part"></param> |
61 | public void QueuePartForUpdate(SceneObjectPart part) | 64 | public void QueuePartForUpdate(SceneObjectPart part) |
62 | { | 65 | { |
66 | // if (part.IsAttachment) | ||
67 | // m_log.DebugFormat("[SCENE VIEWER]: Queueing part {0} {1} for update", part.Name, part.LocalId); | ||
68 | |||
63 | lock (m_partsUpdateQueue) | 69 | lock (m_partsUpdateQueue) |
64 | { | 70 | { |
65 | m_partsUpdateQueue.Enqueue(part); | 71 | m_partsUpdateQueue.Enqueue(part); |
@@ -134,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
134 | } | 140 | } |
135 | else if (update.LastTerseUpdateTime <= part.TimeStampTerse) | 141 | else if (update.LastTerseUpdateTime <= part.TimeStampTerse) |
136 | { | 142 | { |
137 | // m_log.DebugFormat( | 143 | // m_log.DebugFormat(AddFullUpdateToAvatar |
138 | // "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}", | 144 | // "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}", |
139 | // part.Name, part.UUID, part.TimeStampTerse); | 145 | // part.Name, part.UUID, part.TimeStampTerse); |
140 | 146 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 861731c..e64c9a7 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Text; | ||
32 | 33 | ||
33 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
34 | 35 | ||
@@ -42,6 +43,7 @@ using OpenMetaverse.StructuredData; | |||
42 | using OpenSim.Framework; | 43 | using OpenSim.Framework; |
43 | using OpenSim.Framework.Communications; | 44 | using OpenSim.Framework.Communications; |
44 | using OpenSim.Region.Framework.Interfaces; | 45 | using OpenSim.Region.Framework.Interfaces; |
46 | using OpenSim.Services.Interfaces; | ||
45 | 47 | ||
46 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 48 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
47 | { | 49 | { |
@@ -72,7 +74,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
72 | 74 | ||
73 | private bool m_debugEnabled = false; | 75 | private bool m_debugEnabled = false; |
74 | 76 | ||
75 | 77 | private ExpiringCache<string, XmlRpcResponse> m_memoryCache; | |
78 | private int m_cacheTimeout = 30; | ||
79 | |||
76 | // Used to track which agents are have dropped from a group chat session | 80 | // Used to track which agents are have dropped from a group chat session |
77 | // Should be reset per agent, on logon | 81 | // Should be reset per agent, on logon |
78 | // TODO: move this to Flotsam XmlRpc Service | 82 | // TODO: move this to Flotsam XmlRpc Service |
@@ -132,8 +136,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
132 | 136 | ||
133 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); | 137 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); |
134 | 138 | ||
135 | 139 | m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30); | |
140 | if (m_cacheTimeout == 0) | ||
141 | { | ||
142 | m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled."); | ||
143 | } | ||
144 | else | ||
145 | { | ||
146 | m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Timeout set to {0}.", m_cacheTimeout); | ||
147 | } | ||
148 | |||
136 | // If we got all the config options we need, lets start'er'up | 149 | // If we got all the config options we need, lets start'er'up |
150 | m_memoryCache = new ExpiringCache<string, XmlRpcResponse>(); | ||
137 | m_connectorEnabled = true; | 151 | m_connectorEnabled = true; |
138 | } | 152 | } |
139 | } | 153 | } |
@@ -921,61 +935,94 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
921 | /// </summary> | 935 | /// </summary> |
922 | private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) | 936 | private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) |
923 | { | 937 | { |
924 | string UserService; | 938 | XmlRpcResponse resp = null; |
925 | UUID SessionID; | 939 | string CacheKey = null; |
926 | GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); | ||
927 | param.Add("RequestingAgentID", requestingAgentID.ToString()); | ||
928 | param.Add("RequestingAgentUserService", UserService); | ||
929 | param.Add("RequestingSessionID", SessionID.ToString()); | ||
930 | |||
931 | |||
932 | param.Add("ReadKey", m_groupReadKey); | ||
933 | param.Add("WriteKey", m_groupWriteKey); | ||
934 | 940 | ||
935 | if (m_debugEnabled) | 941 | // Only bother with the cache if it isn't disabled. |
942 | if (m_cacheTimeout > 0) | ||
936 | { | 943 | { |
937 | m_log.Debug("[XMLRPCGROUPDATA] XmlRpcCall Params:"); | 944 | if (!function.StartsWith("groups.get")) |
938 | foreach (string key in param.Keys) | ||
939 | { | 945 | { |
940 | m_log.DebugFormat("[XMLRPCGROUPDATA] {0} : {1}", key, param[key]); | 946 | // Any and all updates cause the cache to clear |
947 | m_memoryCache.Clear(); | ||
941 | } | 948 | } |
942 | } | 949 | else |
943 | 950 | { | |
944 | IList parameters = new ArrayList(); | 951 | StringBuilder sb = new StringBuilder(requestingAgentID + function); |
945 | parameters.Add(param); | 952 | foreach (object key in param.Keys) |
946 | 953 | { | |
947 | ConfigurableKeepAliveXmlRpcRequest req; | 954 | if (param[key] != null) |
948 | req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); | 955 | { |
949 | 956 | sb.AppendFormat(",{0}:{1}", key.ToString(), param[key].ToString()); | |
950 | XmlRpcResponse resp = null; | 957 | } |
958 | } | ||
951 | 959 | ||
952 | try | 960 | CacheKey = sb.ToString(); |
953 | { | 961 | m_memoryCache.TryGetValue(CacheKey, out resp); |
954 | resp = req.Send(m_groupsServerURI, 10000); | 962 | } |
955 | } | 963 | } |
956 | catch (Exception e) | 964 | |
965 | if (resp == null) | ||
957 | { | 966 | { |
967 | string UserService; | ||
968 | UUID SessionID; | ||
969 | GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); | ||
970 | param.Add("RequestingAgentID", requestingAgentID.ToString()); | ||
971 | param.Add("RequestingAgentUserService", UserService); | ||
972 | param.Add("RequestingSessionID", SessionID.ToString()); | ||
958 | 973 | ||
959 | 974 | ||
960 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); | 975 | param.Add("ReadKey", m_groupReadKey); |
961 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); | 976 | param.Add("WriteKey", m_groupWriteKey); |
962 | 977 | ||
963 | if ((req != null) && (req.RequestResponse != null)) | 978 | if (m_debugEnabled) |
964 | { | ||
965 | foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) | ||
966 | { | 979 | { |
967 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); | 980 | m_log.Debug("[XMLRPCGROUPDATA] XmlRpcCall Params:"); |
981 | foreach (string key in param.Keys) | ||
982 | { | ||
983 | m_log.DebugFormat("[XMLRPCGROUPDATA] {0} : {1}", key, param[key]); | ||
984 | } | ||
968 | } | 985 | } |
986 | |||
987 | IList parameters = new ArrayList(); | ||
988 | parameters.Add(param); | ||
989 | |||
990 | ConfigurableKeepAliveXmlRpcRequest req; | ||
991 | req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); | ||
992 | |||
993 | try | ||
994 | { | ||
995 | resp = req.Send(m_groupsServerURI, 10000); | ||
996 | |||
997 | if ((m_cacheTimeout > 0) && (CacheKey != null)) | ||
998 | { | ||
999 | m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout)); | ||
1000 | } | ||
969 | } | 1001 | } |
970 | 1002 | catch (Exception e) | |
971 | foreach (string key in param.Keys) | ||
972 | { | 1003 | { |
973 | m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); | 1004 | |
1005 | |||
1006 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); | ||
1007 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); | ||
1008 | |||
1009 | if ((req != null) && (req.RequestResponse != null)) | ||
1010 | { | ||
1011 | foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) | ||
1012 | { | ||
1013 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); | ||
1014 | } | ||
1015 | } | ||
1016 | |||
1017 | foreach (string key in param.Keys) | ||
1018 | { | ||
1019 | m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); | ||
1020 | } | ||
1021 | |||
1022 | Hashtable respData = new Hashtable(); | ||
1023 | respData.Add("error", e.ToString()); | ||
1024 | return respData; | ||
974 | } | 1025 | } |
975 | |||
976 | Hashtable respData = new Hashtable(); | ||
977 | respData.Add("error", e.ToString()); | ||
978 | return respData; | ||
979 | } | 1026 | } |
980 | 1027 | ||
981 | 1028 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ec7fde0..012ba90 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -467,13 +467,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
467 | 467 | ||
468 | public LSL_Vector llVecNorm(LSL_Vector v) | 468 | public LSL_Vector llVecNorm(LSL_Vector v) |
469 | { | 469 | { |
470 | m_host.AddScriptLPS(1); | 470 | m_host.AddScriptLPS(1); |
471 | double mag = LSL_Vector.Mag(v); | 471 | return LSL_Vector.Norm(v); |
472 | LSL_Vector nor = new LSL_Vector(); | ||
473 | nor.x = v.x / mag; | ||
474 | nor.y = v.y / mag; | ||
475 | nor.z = v.z / mag; | ||
476 | return nor; | ||
477 | } | 472 | } |
478 | 473 | ||
479 | public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) | 474 | public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 1ea52c5..326f327 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -257,12 +257,17 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
257 | public static double Mag(Vector3 v) | 257 | public static double Mag(Vector3 v) |
258 | { | 258 | { |
259 | return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); | 259 | return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); |
260 | } | 260 | } |
261 | 261 | ||
262 | public static Vector3 Norm(Vector3 vector) | 262 | public static Vector3 Norm(Vector3 vector) |
263 | { | 263 | { |
264 | double mag = Mag(vector); | 264 | double mag = Mag(vector); |
265 | return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); | 265 | if (mag > 0.0) |
266 | { | ||
267 | double invMag = 1.0 / mag; | ||
268 | return vector * invMag; | ||
269 | } | ||
270 | return new Vector3(0, 0, 0); | ||
266 | } | 271 | } |
267 | 272 | ||
268 | #endregion | 273 | #endregion |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 35d57d8..3bdbdfb 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -125,6 +125,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
125 | 125 | ||
126 | private ScriptCompileQueue m_CompileQueue = new ScriptCompileQueue(); | 126 | private ScriptCompileQueue m_CompileQueue = new ScriptCompileQueue(); |
127 | IWorkItemResult m_CurrentCompile = null; | 127 | IWorkItemResult m_CurrentCompile = null; |
128 | private Dictionary<UUID, int> m_CompileDict = new Dictionary<UUID, int>(); | ||
128 | 129 | ||
129 | private void lockScriptsForRead(bool locked) | 130 | private void lockScriptsForRead(bool locked) |
130 | { | 131 | { |
@@ -555,11 +556,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
555 | 556 | ||
556 | if (stateSource == (int)StateSource.ScriptedRez) | 557 | if (stateSource == (int)StateSource.ScriptedRez) |
557 | { | 558 | { |
559 | lock (m_CompileDict) | ||
560 | { | ||
561 | m_CompileDict[itemID] = 0; | ||
562 | } | ||
563 | |||
558 | DoOnRezScript(parms); | 564 | DoOnRezScript(parms); |
559 | } | 565 | } |
560 | else | 566 | else |
561 | { | 567 | { |
562 | m_CompileQueue.Enqueue(parms); | 568 | m_CompileQueue.Enqueue(parms); |
569 | lock (m_CompileDict) | ||
570 | { | ||
571 | m_CompileDict[itemID] = 0; | ||
572 | } | ||
563 | 573 | ||
564 | if (m_CurrentCompile == null) | 574 | if (m_CurrentCompile == null) |
565 | { | 575 | { |
@@ -622,6 +632,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
622 | bool postOnRez = (bool)p[4]; | 632 | bool postOnRez = (bool)p[4]; |
623 | StateSource stateSource = (StateSource)p[5]; | 633 | StateSource stateSource = (StateSource)p[5]; |
624 | 634 | ||
635 | lock(m_CompileDict) | ||
636 | { | ||
637 | if (!m_CompileDict.ContainsKey(itemID)) | ||
638 | return false; | ||
639 | m_CompileDict.Remove(itemID); | ||
640 | } | ||
641 | |||
625 | // Get the asset ID of the script, so we can check if we | 642 | // Get the asset ID of the script, so we can check if we |
626 | // already have it. | 643 | // already have it. |
627 | 644 | ||
@@ -868,9 +885,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
868 | 885 | ||
869 | public void OnRemoveScript(uint localID, UUID itemID) | 886 | public void OnRemoveScript(uint localID, UUID itemID) |
870 | { | 887 | { |
871 | lockScriptsForRead(true); | 888 | // If it's not yet been compiled, make sure we don't try |
872 | // Do we even have it? | 889 | lock (m_CompileDict) |
873 | if (!m_Scripts.ContainsKey(itemID)) | 890 | { |
891 | if (m_CompileDict.ContainsKey(itemID)) | ||
892 | m_CompileDict.Remove(itemID); | ||
893 | } | ||
894 | |||
895 | lock (m_Scripts) | ||
874 | { | 896 | { |
875 | lockScriptsForRead(false); | 897 | lockScriptsForRead(false); |
876 | return; | 898 | return; |
@@ -1375,10 +1397,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1375 | 1397 | ||
1376 | try | 1398 | try |
1377 | { | 1399 | { |
1378 | FileStream tfs = File.Open(assemName + ".text", | 1400 | using (FileStream tfs = File.Open(assemName + ".text", |
1379 | FileMode.Open, FileAccess.Read); | 1401 | FileMode.Open, FileAccess.Read)) |
1380 | tfs.Read(tdata, 0, tdata.Length); | 1402 | { |
1381 | tfs.Close(); | 1403 | tfs.Read(tdata, 0, tdata.Length); |
1404 | tfs.Close(); | ||
1405 | } | ||
1382 | 1406 | ||
1383 | assem = new System.Text.ASCIIEncoding().GetString(tdata); | 1407 | assem = new System.Text.ASCIIEncoding().GetString(tdata); |
1384 | } | 1408 | } |
@@ -1398,9 +1422,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1398 | 1422 | ||
1399 | try | 1423 | try |
1400 | { | 1424 | { |
1401 | FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read); | 1425 | using (FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read)) |
1402 | fs.Read(data, 0, data.Length); | 1426 | { |
1403 | fs.Close(); | 1427 | fs.Read(data, 0, data.Length); |
1428 | fs.Close(); | ||
1429 | } | ||
1404 | 1430 | ||
1405 | assem = System.Convert.ToBase64String(data); | 1431 | assem = System.Convert.ToBase64String(data); |
1406 | } | 1432 | } |
@@ -1416,13 +1442,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1416 | 1442 | ||
1417 | if (File.Exists(fn + ".map")) | 1443 | if (File.Exists(fn + ".map")) |
1418 | { | 1444 | { |
1419 | FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read); | 1445 | using (FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read)) |
1420 | StreamReader msr = new StreamReader(mfs); | 1446 | { |
1421 | 1447 | using (StreamReader msr = new StreamReader(mfs)) | |
1422 | map = msr.ReadToEnd(); | 1448 | { |
1423 | 1449 | map = msr.ReadToEnd(); | |
1424 | msr.Close(); | 1450 | msr.Close(); |
1425 | mfs.Close(); | 1451 | } |
1452 | mfs.Close(); | ||
1453 | } | ||
1426 | } | 1454 | } |
1427 | 1455 | ||
1428 | XmlElement assemblyData = doc.CreateElement("", "Assembly", ""); | 1456 | XmlElement assemblyData = doc.CreateElement("", "Assembly", ""); |
@@ -1510,30 +1538,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1510 | { | 1538 | { |
1511 | Byte[] filedata = Convert.FromBase64String(base64); | 1539 | Byte[] filedata = Convert.FromBase64String(base64); |
1512 | 1540 | ||
1513 | FileStream fs = File.Create(path); | 1541 | try |
1514 | fs.Write(filedata, 0, filedata.Length); | 1542 | { |
1515 | fs.Close(); | 1543 | using (FileStream fs = File.Create(path)) |
1516 | 1544 | { | |
1517 | fs = File.Create(path + ".text"); | 1545 | fs.Write(filedata, 0, filedata.Length); |
1518 | StreamWriter sw = new StreamWriter(fs); | 1546 | fs.Close(); |
1519 | 1547 | } | |
1520 | sw.Write(base64); | 1548 | } |
1521 | 1549 | catch (IOException ex) | |
1522 | sw.Close(); | 1550 | { |
1523 | fs.Close(); | 1551 | // if there already exists a file at that location, it may be locked. |
1552 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message); | ||
1553 | } | ||
1554 | try | ||
1555 | { | ||
1556 | using (FileStream fs = File.Create(path + ".text")) | ||
1557 | { | ||
1558 | using (StreamWriter sw = new StreamWriter(fs)) | ||
1559 | { | ||
1560 | sw.Write(base64); | ||
1561 | sw.Close(); | ||
1562 | } | ||
1563 | fs.Close(); | ||
1564 | } | ||
1565 | } | ||
1566 | catch (IOException ex) | ||
1567 | { | ||
1568 | // if there already exists a file at that location, it may be locked. | ||
1569 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message); | ||
1570 | } | ||
1524 | } | 1571 | } |
1525 | } | 1572 | } |
1526 | 1573 | ||
1527 | string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); | 1574 | string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); |
1528 | statepath = Path.Combine(statepath, itemID.ToString() + ".state"); | 1575 | statepath = Path.Combine(statepath, itemID.ToString() + ".state"); |
1529 | 1576 | ||
1530 | FileStream sfs = File.Create(statepath); | 1577 | try |
1531 | StreamWriter ssw = new StreamWriter(sfs); | 1578 | { |
1532 | 1579 | using (FileStream sfs = File.Create(statepath)) | |
1533 | ssw.Write(stateE.OuterXml); | 1580 | { |
1534 | 1581 | using (StreamWriter ssw = new StreamWriter(sfs)) | |
1535 | ssw.Close(); | 1582 | { |
1536 | sfs.Close(); | 1583 | ssw.Write(stateE.OuterXml); |
1584 | ssw.Close(); | ||
1585 | } | ||
1586 | sfs.Close(); | ||
1587 | } | ||
1588 | } | ||
1589 | catch (IOException ex) | ||
1590 | { | ||
1591 | // if there already exists a file at that location, it may be locked. | ||
1592 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message); | ||
1593 | } | ||
1537 | 1594 | ||
1538 | XmlNodeList mapL = rootE.GetElementsByTagName("LineMap"); | 1595 | XmlNodeList mapL = rootE.GetElementsByTagName("LineMap"); |
1539 | if (mapL.Count > 0) | 1596 | if (mapL.Count > 0) |
@@ -1543,13 +1600,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1543 | string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); | 1600 | string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); |
1544 | mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); | 1601 | mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); |
1545 | 1602 | ||
1546 | FileStream mfs = File.Create(mappath); | 1603 | try |
1547 | StreamWriter msw = new StreamWriter(mfs); | 1604 | { |
1548 | 1605 | using (FileStream mfs = File.Create(mappath)) | |
1549 | msw.Write(mapE.InnerText); | 1606 | { |
1550 | 1607 | using (StreamWriter msw = new StreamWriter(mfs)) | |
1551 | msw.Close(); | 1608 | { |
1552 | mfs.Close(); | 1609 | msw.Write(mapE.InnerText); |
1610 | msw.Close(); | ||
1611 | } | ||
1612 | mfs.Close(); | ||
1613 | } | ||
1614 | } | ||
1615 | catch (IOException ex) | ||
1616 | { | ||
1617 | // if there already exists a file at that location, it may be locked. | ||
1618 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message); | ||
1619 | } | ||
1553 | } | 1620 | } |
1554 | 1621 | ||
1555 | return true; | 1622 | return true; |