aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs186
1 files changed, 149 insertions, 37 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