diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 1494 |
1 files changed, 921 insertions, 573 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index dd8ef9c..9de564b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -101,6 +101,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
101 | public event AvatarPickerRequest OnAvatarPickerRequest; | 101 | public event AvatarPickerRequest OnAvatarPickerRequest; |
102 | public event StartAnim OnStartAnim; | 102 | public event StartAnim OnStartAnim; |
103 | public event StopAnim OnStopAnim; | 103 | public event StopAnim OnStopAnim; |
104 | public event ChangeAnim OnChangeAnim; | ||
104 | public event Action<IClientAPI> OnRequestAvatarsData; | 105 | public event Action<IClientAPI> OnRequestAvatarsData; |
105 | public event LinkObjects OnLinkObjects; | 106 | public event LinkObjects OnLinkObjects; |
106 | public event DelinkObjects OnDelinkObjects; | 107 | public event DelinkObjects OnDelinkObjects; |
@@ -128,6 +129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
128 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; | 129 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; |
129 | public event UpdatePrimFlags OnUpdatePrimFlags; | 130 | public event UpdatePrimFlags OnUpdatePrimFlags; |
130 | public event UpdatePrimTexture OnUpdatePrimTexture; | 131 | public event UpdatePrimTexture OnUpdatePrimTexture; |
132 | public event ClientChangeObject onClientChangeObject; | ||
131 | public event UpdateVector OnUpdatePrimGroupPosition; | 133 | public event UpdateVector OnUpdatePrimGroupPosition; |
132 | public event UpdateVector OnUpdatePrimSinglePosition; | 134 | public event UpdateVector OnUpdatePrimSinglePosition; |
133 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | 135 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; |
@@ -161,6 +163,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
161 | public event RequestTaskInventory OnRequestTaskInventory; | 163 | public event RequestTaskInventory OnRequestTaskInventory; |
162 | public event UpdateInventoryItem OnUpdateInventoryItem; | 164 | public event UpdateInventoryItem OnUpdateInventoryItem; |
163 | public event CopyInventoryItem OnCopyInventoryItem; | 165 | public event CopyInventoryItem OnCopyInventoryItem; |
166 | public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | ||
164 | public event MoveInventoryItem OnMoveInventoryItem; | 167 | public event MoveInventoryItem OnMoveInventoryItem; |
165 | public event RemoveInventoryItem OnRemoveInventoryItem; | 168 | public event RemoveInventoryItem OnRemoveInventoryItem; |
166 | public event RemoveInventoryFolder OnRemoveInventoryFolder; | 169 | public event RemoveInventoryFolder OnRemoveInventoryFolder; |
@@ -259,7 +262,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
259 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; | 262 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; |
260 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | 263 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; |
261 | public event ClassifiedDelete OnClassifiedDelete; | 264 | public event ClassifiedDelete OnClassifiedDelete; |
262 | public event ClassifiedDelete OnClassifiedGodDelete; | 265 | public event ClassifiedGodDelete OnClassifiedGodDelete; |
263 | public event EventNotificationAddRequest OnEventNotificationAddRequest; | 266 | public event EventNotificationAddRequest OnEventNotificationAddRequest; |
264 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | 267 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; |
265 | public event EventGodDelete OnEventGodDelete; | 268 | public event EventGodDelete OnEventGodDelete; |
@@ -290,10 +293,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
290 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; | 293 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; |
291 | public event SimWideDeletesDelegate OnSimWideDeletes; | 294 | public event SimWideDeletesDelegate OnSimWideDeletes; |
292 | public event SendPostcard OnSendPostcard; | 295 | public event SendPostcard OnSendPostcard; |
296 | public event ChangeInventoryItemFlags OnChangeInventoryItemFlags; | ||
293 | public event MuteListEntryUpdate OnUpdateMuteListEntry; | 297 | public event MuteListEntryUpdate OnUpdateMuteListEntry; |
294 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 298 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
295 | public event GodlikeMessage onGodlikeMessage; | 299 | public event GodlikeMessage onGodlikeMessage; |
296 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 300 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
301 | public event GenericCall2 OnUpdateThrottles; | ||
297 | 302 | ||
298 | #endregion Events | 303 | #endregion Events |
299 | 304 | ||
@@ -322,11 +327,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
322 | private readonly byte[] m_channelVersion = Utils.EmptyBytes; | 327 | private readonly byte[] m_channelVersion = Utils.EmptyBytes; |
323 | private readonly IGroupsModule m_GroupsModule; | 328 | private readonly IGroupsModule m_GroupsModule; |
324 | 329 | ||
330 | private int m_cachedTextureSerial; | ||
325 | private PriorityQueue m_entityUpdates; | 331 | private PriorityQueue m_entityUpdates; |
326 | private PriorityQueue m_entityProps; | 332 | private PriorityQueue m_entityProps; |
327 | private Prioritizer m_prioritizer; | 333 | private Prioritizer m_prioritizer; |
328 | private bool m_disableFacelights = false; | 334 | private bool m_disableFacelights = false; |
329 | 335 | ||
336 | private bool m_VelocityInterpolate = false; | ||
337 | private const uint MaxTransferBytesPerPacket = 600; | ||
338 | |||
339 | |||
330 | /// <value> | 340 | /// <value> |
331 | /// List used in construction of data blocks for an object update packet. This is to stop us having to | 341 | /// List used in construction of data blocks for an object update packet. This is to stop us having to |
332 | /// continually recreate it. | 342 | /// continually recreate it. |
@@ -338,14 +348,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
338 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an | 348 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an |
339 | /// ownerless phantom. | 349 | /// ownerless phantom. |
340 | /// | 350 | /// |
341 | /// All manipulation of this set has to occur under a lock | 351 | /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock |
342 | /// | 352 | /// |
343 | /// </value> | 353 | /// </value> |
344 | protected HashSet<uint> m_killRecord; | 354 | // protected HashSet<uint> m_killRecord; |
345 | 355 | ||
346 | // protected HashSet<uint> m_attachmentsSent; | 356 | // protected HashSet<uint> m_attachmentsSent; |
347 | 357 | ||
348 | private int m_moneyBalance; | 358 | private int m_moneyBalance; |
359 | private bool m_deliverPackets = true; | ||
349 | private int m_animationSequenceNumber = 1; | 360 | private int m_animationSequenceNumber = 1; |
350 | private bool m_SendLogoutPacketWhenClosing = true; | 361 | private bool m_SendLogoutPacketWhenClosing = true; |
351 | 362 | ||
@@ -392,6 +403,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
392 | get { return m_startpos; } | 403 | get { return m_startpos; } |
393 | set { m_startpos = value; } | 404 | set { m_startpos = value; } |
394 | } | 405 | } |
406 | public bool DeliverPackets | ||
407 | { | ||
408 | get { return m_deliverPackets; } | ||
409 | set { | ||
410 | m_deliverPackets = value; | ||
411 | m_udpClient.m_deliverPackets = value; | ||
412 | } | ||
413 | } | ||
395 | public UUID AgentId { get { return m_agentId; } } | 414 | public UUID AgentId { get { return m_agentId; } } |
396 | public ISceneAgent SceneAgent { get; set; } | 415 | public ISceneAgent SceneAgent { get; set; } |
397 | public UUID ActiveGroupId { get { return m_activeGroupID; } } | 416 | public UUID ActiveGroupId { get { return m_activeGroupID; } } |
@@ -443,6 +462,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
443 | } | 462 | } |
444 | 463 | ||
445 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } | 464 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } |
465 | |||
446 | 466 | ||
447 | #endregion Properties | 467 | #endregion Properties |
448 | 468 | ||
@@ -469,7 +489,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
469 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); | 489 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); |
470 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); | 490 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); |
471 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); | 491 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); |
472 | m_killRecord = new HashSet<uint>(); | 492 | // m_killRecord = new HashSet<uint>(); |
473 | // m_attachmentsSent = new HashSet<uint>(); | 493 | // m_attachmentsSent = new HashSet<uint>(); |
474 | 494 | ||
475 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | 495 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); |
@@ -499,12 +519,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
499 | 519 | ||
500 | #region Client Methods | 520 | #region Client Methods |
501 | 521 | ||
522 | |||
523 | /// <summary> | ||
524 | /// Close down the client view | ||
525 | /// </summary> | ||
502 | public void Close() | 526 | public void Close() |
503 | { | 527 | { |
504 | Close(false); | 528 | Close(true, false); |
505 | } | 529 | } |
506 | 530 | ||
507 | public void Close(bool force) | 531 | public void Close(bool sendStop, bool force) |
508 | { | 532 | { |
509 | // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. | 533 | // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. |
510 | // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. | 534 | // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. |
@@ -516,7 +540,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
516 | return; | 540 | return; |
517 | 541 | ||
518 | IsActive = false; | 542 | IsActive = false; |
519 | CloseWithoutChecks(); | 543 | CloseWithoutChecks(sendStop); |
520 | } | 544 | } |
521 | } | 545 | } |
522 | 546 | ||
@@ -529,12 +553,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
529 | /// | 553 | /// |
530 | /// Callers must lock ClosingSyncLock before calling. | 554 | /// Callers must lock ClosingSyncLock before calling. |
531 | /// </remarks> | 555 | /// </remarks> |
532 | public void CloseWithoutChecks() | 556 | public void CloseWithoutChecks(bool sendStop) |
533 | { | 557 | { |
534 | m_log.DebugFormat( | 558 | m_log.DebugFormat( |
535 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 559 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
536 | Name, m_scene.RegionInfo.RegionName); | 560 | Name, m_scene.RegionInfo.RegionName); |
537 | 561 | ||
562 | if (sendStop) | ||
563 | { | ||
564 | // Send the STOP packet | ||
565 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
566 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
567 | } | ||
568 | |||
538 | // Shutdown the image manager | 569 | // Shutdown the image manager |
539 | ImageManager.Close(); | 570 | ImageManager.Close(); |
540 | 571 | ||
@@ -557,6 +588,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
557 | // Disable UDP handling for this client | 588 | // Disable UDP handling for this client |
558 | m_udpClient.Shutdown(); | 589 | m_udpClient.Shutdown(); |
559 | 590 | ||
591 | |||
560 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 592 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
561 | //GC.Collect(); | 593 | //GC.Collect(); |
562 | //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 594 | //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
@@ -797,7 +829,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
797 | handshake.RegionInfo4[0].RegionFlagsExtended = args.regionFlags; | 829 | handshake.RegionInfo4[0].RegionFlagsExtended = args.regionFlags; |
798 | handshake.RegionInfo4[0].RegionProtocols = 0; // 1 here would indicate that SSB is supported | 830 | handshake.RegionInfo4[0].RegionProtocols = 0; // 1 here would indicate that SSB is supported |
799 | 831 | ||
800 | OutPacket(handshake, ThrottleOutPacketType.Task); | 832 | OutPacket(handshake, ThrottleOutPacketType.Unknown); |
801 | } | 833 | } |
802 | 834 | ||
803 | 835 | ||
@@ -838,7 +870,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
838 | reply.ChatData.OwnerID = ownerID; | 870 | reply.ChatData.OwnerID = ownerID; |
839 | reply.ChatData.SourceID = fromAgentID; | 871 | reply.ChatData.SourceID = fromAgentID; |
840 | 872 | ||
841 | OutPacket(reply, ThrottleOutPacketType.Task); | 873 | OutPacket(reply, ThrottleOutPacketType.Unknown); |
842 | } | 874 | } |
843 | 875 | ||
844 | /// <summary> | 876 | /// <summary> |
@@ -871,32 +903,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
871 | msg.MessageBlock.Message = Util.StringToBytes1024(im.message); | 903 | msg.MessageBlock.Message = Util.StringToBytes1024(im.message); |
872 | msg.MessageBlock.BinaryBucket = im.binaryBucket; | 904 | msg.MessageBlock.BinaryBucket = im.binaryBucket; |
873 | 905 | ||
874 | if (im.message.StartsWith("[grouptest]")) | 906 | OutPacket(msg, ThrottleOutPacketType.Task); |
875 | { // this block is test code for implementing group IM - delete when group IM is finished | ||
876 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | ||
877 | if (eq != null) | ||
878 | { | ||
879 | im.dialog = 17; | ||
880 | |||
881 | //eq.ChatterboxInvitation( | ||
882 | // new UUID("00000000-68f9-1111-024e-222222111123"), | ||
883 | // "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0, | ||
884 | // false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket); | ||
885 | |||
886 | eq.ChatterboxInvitation( | ||
887 | new UUID("00000000-68f9-1111-024e-222222111123"), | ||
888 | "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0, | ||
889 | false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing")); | ||
890 | |||
891 | eq.ChatterBoxSessionAgentListUpdates( | ||
892 | new UUID("00000000-68f9-1111-024e-222222111123"), | ||
893 | new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false); | ||
894 | } | ||
895 | |||
896 | Console.WriteLine("SendInstantMessage: " + msg); | ||
897 | } | ||
898 | else | ||
899 | OutPacket(msg, ThrottleOutPacketType.Task); | ||
900 | } | 907 | } |
901 | } | 908 | } |
902 | 909 | ||
@@ -1134,6 +1141,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1134 | public virtual void SendLayerData(float[] map) | 1141 | public virtual void SendLayerData(float[] map) |
1135 | { | 1142 | { |
1136 | Util.FireAndForget(DoSendLayerData, map); | 1143 | Util.FireAndForget(DoSendLayerData, map); |
1144 | |||
1145 | // Send it sync, and async. It's not that much data | ||
1146 | // and it improves user experience just so much! | ||
1147 | DoSendLayerData(map); | ||
1137 | } | 1148 | } |
1138 | 1149 | ||
1139 | /// <summary> | 1150 | /// <summary> |
@@ -1146,16 +1157,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1146 | 1157 | ||
1147 | try | 1158 | try |
1148 | { | 1159 | { |
1149 | //for (int y = 0; y < 16; y++) | 1160 | for (int y = 0; y < 16; y++) |
1150 | //{ | 1161 | { |
1151 | // for (int x = 0; x < 16; x++) | 1162 | for (int x = 0; x < 16; x+=4) |
1152 | // { | 1163 | { |
1153 | // SendLayerData(x, y, map); | 1164 | SendLayerPacket(x, y, map); |
1154 | // } | 1165 | } |
1155 | //} | 1166 | } |
1156 | |||
1157 | // Send LayerData in a spiral pattern. Fun! | ||
1158 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
1159 | } | 1167 | } |
1160 | catch (Exception e) | 1168 | catch (Exception e) |
1161 | { | 1169 | { |
@@ -1163,51 +1171,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1163 | } | 1171 | } |
1164 | } | 1172 | } |
1165 | 1173 | ||
1166 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
1167 | { | ||
1168 | // Row | ||
1169 | for (int i = x1; i <= x2; i++) | ||
1170 | SendLayerData(i, y1, map); | ||
1171 | |||
1172 | // Column | ||
1173 | for (int j = y1 + 1; j <= y2; j++) | ||
1174 | SendLayerData(x2, j, map); | ||
1175 | |||
1176 | if (x2 - x1 > 0) | ||
1177 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
1178 | } | ||
1179 | |||
1180 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
1181 | { | ||
1182 | // Row in reverse | ||
1183 | for (int i = x2; i >= x1; i--) | ||
1184 | SendLayerData(i, y2, map); | ||
1185 | |||
1186 | // Column in reverse | ||
1187 | for (int j = y2 - 1; j >= y1; j--) | ||
1188 | SendLayerData(x1, j, map); | ||
1189 | |||
1190 | if (x2 - x1 > 0) | ||
1191 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
1192 | } | ||
1193 | |||
1194 | /// <summary> | 1174 | /// <summary> |
1195 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 1175 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
1196 | /// </summary> | 1176 | /// </summary> |
1197 | /// <param name="map">heightmap</param> | 1177 | /// <param name="map">heightmap</param> |
1198 | /// <param name="px">X coordinate for patches 0..12</param> | 1178 | /// <param name="px">X coordinate for patches 0..12</param> |
1199 | /// <param name="py">Y coordinate for patches 0..15</param> | 1179 | /// <param name="py">Y coordinate for patches 0..15</param> |
1200 | // private void SendLayerPacket(float[] map, int y, int x) | 1180 | private void SendLayerPacket(int x, int y, float[] map) |
1201 | // { | 1181 | { |
1202 | // int[] patches = new int[4]; | 1182 | int[] patches = new int[4]; |
1203 | // patches[0] = x + 0 + y * 16; | 1183 | patches[0] = x + 0 + y * 16; |
1204 | // patches[1] = x + 1 + y * 16; | 1184 | patches[1] = x + 1 + y * 16; |
1205 | // patches[2] = x + 2 + y * 16; | 1185 | patches[2] = x + 2 + y * 16; |
1206 | // patches[3] = x + 3 + y * 16; | 1186 | patches[3] = x + 3 + y * 16; |
1207 | 1187 | ||
1208 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 1188 | float[] heightmap = (map.Length == 65536) ? |
1209 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1189 | map : |
1210 | // } | 1190 | LLHeightFieldMoronize(map); |
1191 | |||
1192 | try | ||
1193 | { | ||
1194 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1195 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1196 | } | ||
1197 | catch | ||
1198 | { | ||
1199 | for (int px = x ; px < x + 4 ; px++) | ||
1200 | SendLayerData(px, y, map); | ||
1201 | } | ||
1202 | } | ||
1211 | 1203 | ||
1212 | /// <summary> | 1204 | /// <summary> |
1213 | /// Sends a specified patch to a client | 1205 | /// Sends a specified patch to a client |
@@ -1227,7 +1219,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1227 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 1219 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); |
1228 | layerpack.Header.Reliable = true; | 1220 | layerpack.Header.Reliable = true; |
1229 | 1221 | ||
1230 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1222 | OutPacket(layerpack, ThrottleOutPacketType.Task); |
1231 | } | 1223 | } |
1232 | catch (Exception e) | 1224 | catch (Exception e) |
1233 | { | 1225 | { |
@@ -1590,7 +1582,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1590 | 1582 | ||
1591 | public void SendKillObject(List<uint> localIDs) | 1583 | public void SendKillObject(List<uint> localIDs) |
1592 | { | 1584 | { |
1593 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); | 1585 | // foreach (uint id in localIDs) |
1586 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); | ||
1594 | 1587 | ||
1595 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); | 1588 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); |
1596 | // TODO: don't create new blocks if recycling an old packet | 1589 | // TODO: don't create new blocks if recycling an old packet |
@@ -1612,17 +1605,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1612 | // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race | 1605 | // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race |
1613 | // condition where a kill can be processed before an out-of-date update for the same object. | 1606 | // condition where a kill can be processed before an out-of-date update for the same object. |
1614 | // ProcessEntityUpdates() also takes the m_killRecord lock. | 1607 | // ProcessEntityUpdates() also takes the m_killRecord lock. |
1615 | lock (m_killRecord) | 1608 | // lock (m_killRecord) |
1616 | { | 1609 | // { |
1617 | foreach (uint localID in localIDs) | 1610 | // foreach (uint localID in localIDs) |
1618 | m_killRecord.Add(localID); | 1611 | // m_killRecord.Add(localID); |
1619 | 1612 | ||
1620 | // The throttle queue used here must match that being used for updates. Otherwise, there is a | 1613 | // The throttle queue used here must match that being used for updates. Otherwise, there is a |
1621 | // chance that a kill packet put on a separate queue will be sent to the client before an existing | 1614 | // chance that a kill packet put on a separate queue will be sent to the client before an existing |
1622 | // update packet on another queue. Receiving updates after kills results in unowned and undeletable | 1615 | // update packet on another queue. Receiving updates after kills results in unowned and undeletable |
1623 | // scene objects in a viewer until that viewer is relogged in. | 1616 | // scene objects in a viewer until that viewer is relogged in. |
1624 | OutPacket(kill, ThrottleOutPacketType.Task); | 1617 | OutPacket(kill, ThrottleOutPacketType.Task); |
1625 | } | 1618 | // } |
1626 | } | 1619 | } |
1627 | } | 1620 | } |
1628 | 1621 | ||
@@ -2081,9 +2074,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2081 | OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); | 2074 | OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); |
2082 | } | 2075 | } |
2083 | 2076 | ||
2084 | /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> | ||
2085 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) | 2077 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) |
2086 | { | 2078 | { |
2079 | SendInventoryItemCreateUpdate(Item, UUID.Zero, callbackId); | ||
2080 | } | ||
2081 | |||
2082 | /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> | ||
2083 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId) | ||
2084 | { | ||
2087 | const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; | 2085 | const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; |
2088 | 2086 | ||
2089 | UpdateCreateInventoryItemPacket InventoryReply | 2087 | UpdateCreateInventoryItemPacket InventoryReply |
@@ -2093,6 +2091,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2093 | // TODO: don't create new blocks if recycling an old packet | 2091 | // TODO: don't create new blocks if recycling an old packet |
2094 | InventoryReply.AgentData.AgentID = AgentId; | 2092 | InventoryReply.AgentData.AgentID = AgentId; |
2095 | InventoryReply.AgentData.SimApproved = true; | 2093 | InventoryReply.AgentData.SimApproved = true; |
2094 | InventoryReply.AgentData.TransactionID = transactionID; | ||
2096 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; | 2095 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; |
2097 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); | 2096 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); |
2098 | InventoryReply.InventoryData[0].ItemID = Item.ID; | 2097 | InventoryReply.InventoryData[0].ItemID = Item.ID; |
@@ -2162,16 +2161,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2162 | replytask.InventoryData.TaskID = taskID; | 2161 | replytask.InventoryData.TaskID = taskID; |
2163 | replytask.InventoryData.Serial = serial; | 2162 | replytask.InventoryData.Serial = serial; |
2164 | replytask.InventoryData.Filename = fileName; | 2163 | replytask.InventoryData.Filename = fileName; |
2165 | OutPacket(replytask, ThrottleOutPacketType.Asset); | 2164 | OutPacket(replytask, ThrottleOutPacketType.Task); |
2166 | } | 2165 | } |
2167 | 2166 | ||
2168 | public void SendXferPacket(ulong xferID, uint packet, byte[] data) | 2167 | public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) |
2169 | { | 2168 | { |
2169 | ThrottleOutPacketType type = ThrottleOutPacketType.Asset; | ||
2170 | if (isTaskInventory) | ||
2171 | type = ThrottleOutPacketType.Task; | ||
2172 | |||
2170 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); | 2173 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); |
2171 | sendXfer.XferID.ID = xferID; | 2174 | sendXfer.XferID.ID = xferID; |
2172 | sendXfer.XferID.Packet = packet; | 2175 | sendXfer.XferID.Packet = packet; |
2173 | sendXfer.DataPacket.Data = data; | 2176 | sendXfer.DataPacket.Data = data; |
2174 | OutPacket(sendXfer, ThrottleOutPacketType.Asset); | 2177 | OutPacket(sendXfer, type); |
2175 | } | 2178 | } |
2176 | 2179 | ||
2177 | public void SendAbortXferPacket(ulong xferID) | 2180 | public void SendAbortXferPacket(ulong xferID) |
@@ -2353,6 +2356,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2353 | OutPacket(sound, ThrottleOutPacketType.Task); | 2356 | OutPacket(sound, ThrottleOutPacketType.Task); |
2354 | } | 2357 | } |
2355 | 2358 | ||
2359 | public void SendTransferAbort(TransferRequestPacket transferRequest) | ||
2360 | { | ||
2361 | TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort); | ||
2362 | abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID; | ||
2363 | abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType; | ||
2364 | m_log.Debug("[Assets] Aborting transfer; asset request failed"); | ||
2365 | OutPacket(abort, ThrottleOutPacketType.Task); | ||
2366 | } | ||
2367 | |||
2356 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) | 2368 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) |
2357 | { | 2369 | { |
2358 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); | 2370 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); |
@@ -2661,6 +2673,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2661 | float friction = part.Friction; | 2673 | float friction = part.Friction; |
2662 | float bounce = part.Restitution; | 2674 | float bounce = part.Restitution; |
2663 | float gravmod = part.GravityModifier; | 2675 | float gravmod = part.GravityModifier; |
2676 | |||
2664 | eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); | 2677 | eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); |
2665 | } | 2678 | } |
2666 | } | 2679 | } |
@@ -2731,8 +2744,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2731 | req.AssetInf.ID, req.AssetInf.Metadata.ContentType); | 2744 | req.AssetInf.ID, req.AssetInf.Metadata.ContentType); |
2732 | return; | 2745 | return; |
2733 | } | 2746 | } |
2747 | int WearableOut = 0; | ||
2748 | bool isWearable = false; | ||
2749 | |||
2750 | if (req.AssetInf != null) | ||
2751 | isWearable = | ||
2752 | ((AssetType) req.AssetInf.Type == | ||
2753 | AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); | ||
2734 | 2754 | ||
2735 | //m_log.Debug("sending asset " + req.RequestAssetID); | 2755 | |
2756 | //m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); | ||
2757 | |||
2758 | |||
2759 | //if (isWearable) | ||
2760 | // m_log.Debug((AssetType)req.AssetInf.Type); | ||
2761 | |||
2736 | TransferInfoPacket Transfer = new TransferInfoPacket(); | 2762 | TransferInfoPacket Transfer = new TransferInfoPacket(); |
2737 | Transfer.TransferInfo.ChannelType = 2; | 2763 | Transfer.TransferInfo.ChannelType = 2; |
2738 | Transfer.TransferInfo.Status = 0; | 2764 | Transfer.TransferInfo.Status = 0; |
@@ -2754,7 +2780,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2754 | Transfer.TransferInfo.Size = req.AssetInf.Data.Length; | 2780 | Transfer.TransferInfo.Size = req.AssetInf.Data.Length; |
2755 | Transfer.TransferInfo.TransferID = req.TransferRequestID; | 2781 | Transfer.TransferInfo.TransferID = req.TransferRequestID; |
2756 | Transfer.Header.Zerocoded = true; | 2782 | Transfer.Header.Zerocoded = true; |
2757 | OutPacket(Transfer, ThrottleOutPacketType.Asset); | 2783 | OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); |
2758 | 2784 | ||
2759 | if (req.NumPackets == 1) | 2785 | if (req.NumPackets == 1) |
2760 | { | 2786 | { |
@@ -2765,12 +2791,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2765 | TransferPacket.TransferData.Data = req.AssetInf.Data; | 2791 | TransferPacket.TransferData.Data = req.AssetInf.Data; |
2766 | TransferPacket.TransferData.Status = 1; | 2792 | TransferPacket.TransferData.Status = 1; |
2767 | TransferPacket.Header.Zerocoded = true; | 2793 | TransferPacket.Header.Zerocoded = true; |
2768 | OutPacket(TransferPacket, ThrottleOutPacketType.Asset); | 2794 | OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); |
2769 | } | 2795 | } |
2770 | else | 2796 | else |
2771 | { | 2797 | { |
2772 | int processedLength = 0; | 2798 | int processedLength = 0; |
2773 | int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; | 2799 | // int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; |
2800 | |||
2801 | int maxChunkSize = (int) MaxTransferBytesPerPacket; | ||
2774 | int packetNumber = 0; | 2802 | int packetNumber = 0; |
2775 | 2803 | ||
2776 | while (processedLength < req.AssetInf.Data.Length) | 2804 | while (processedLength < req.AssetInf.Data.Length) |
@@ -2796,7 +2824,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2796 | TransferPacket.TransferData.Status = 1; | 2824 | TransferPacket.TransferData.Status = 1; |
2797 | } | 2825 | } |
2798 | TransferPacket.Header.Zerocoded = true; | 2826 | TransferPacket.Header.Zerocoded = true; |
2799 | OutPacket(TransferPacket, ThrottleOutPacketType.Asset); | 2827 | OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); |
2800 | 2828 | ||
2801 | processedLength += chunkSize; | 2829 | processedLength += chunkSize; |
2802 | packetNumber++; | 2830 | packetNumber++; |
@@ -2841,7 +2869,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2841 | reply.Data.ParcelID = parcelID; | 2869 | reply.Data.ParcelID = parcelID; |
2842 | reply.Data.OwnerID = land.OwnerID; | 2870 | reply.Data.OwnerID = land.OwnerID; |
2843 | reply.Data.Name = Utils.StringToBytes(land.Name); | 2871 | reply.Data.Name = Utils.StringToBytes(land.Name); |
2844 | reply.Data.Desc = Utils.StringToBytes(land.Description); | 2872 | if (land != null && land.Description != null && land.Description != String.Empty) |
2873 | reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); | ||
2874 | else | ||
2875 | reply.Data.Desc = new Byte[0]; | ||
2845 | reply.Data.ActualArea = land.Area; | 2876 | reply.Data.ActualArea = land.Area; |
2846 | reply.Data.BillableArea = land.Area; // TODO: what is this? | 2877 | reply.Data.BillableArea = land.Area; // TODO: what is this? |
2847 | 2878 | ||
@@ -3548,24 +3579,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3548 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; | 3579 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; |
3549 | AgentWearablesUpdatePacket.WearableDataBlock awb; | 3580 | AgentWearablesUpdatePacket.WearableDataBlock awb; |
3550 | int idx = 0; | 3581 | int idx = 0; |
3551 | for (int i = 0; i < wearables.Length; i++) | 3582 | |
3552 | { | 3583 | for (int i = 0; i < wearables.Length; i++) |
3553 | for (int j = 0; j < wearables[i].Count; j++) | 3584 | { |
3554 | { | 3585 | for (int j = 0; j < wearables[i].Count; j++) |
3555 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | 3586 | { |
3556 | awb.WearableType = (byte)i; | 3587 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); |
3557 | awb.AssetID = wearables[i][j].AssetID; | 3588 | awb.WearableType = (byte) i; |
3558 | awb.ItemID = wearables[i][j].ItemID; | 3589 | awb.AssetID = wearables[i][j].AssetID; |
3559 | aw.WearableData[idx] = awb; | 3590 | awb.ItemID = wearables[i][j].ItemID; |
3560 | idx++; | 3591 | aw.WearableData[idx] = awb; |
3561 | 3592 | idx++; | |
3562 | // m_log.DebugFormat( | 3593 | |
3563 | // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", | 3594 | // m_log.DebugFormat( |
3564 | // awb.ItemID, awb.AssetID, i, Name); | 3595 | // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", |
3565 | } | 3596 | // awb.ItemID, awb.AssetID, i, Name); |
3566 | } | 3597 | } |
3598 | } | ||
3567 | 3599 | ||
3568 | OutPacket(aw, ThrottleOutPacketType.Task); | 3600 | OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); |
3569 | } | 3601 | } |
3570 | 3602 | ||
3571 | public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) | 3603 | public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) |
@@ -3576,7 +3608,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3576 | 3608 | ||
3577 | AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); | 3609 | AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); |
3578 | // TODO: don't create new blocks if recycling an old packet | 3610 | // TODO: don't create new blocks if recycling an old packet |
3579 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | 3611 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length]; |
3580 | avp.ObjectData.TextureEntry = textureEntry; | 3612 | avp.ObjectData.TextureEntry = textureEntry; |
3581 | 3613 | ||
3582 | AvatarAppearancePacket.VisualParamBlock avblock = null; | 3614 | AvatarAppearancePacket.VisualParamBlock avblock = null; |
@@ -3707,7 +3739,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3707 | /// </summary> | 3739 | /// </summary> |
3708 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) | 3740 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) |
3709 | { | 3741 | { |
3710 | //double priority = m_prioritizer.GetUpdatePriority(this, entity); | 3742 | if (entity is SceneObjectPart) |
3743 | { | ||
3744 | SceneObjectPart e = (SceneObjectPart)entity; | ||
3745 | SceneObjectGroup g = e.ParentGroup; | ||
3746 | if (g.RootPart.Shape.State > 30) // HUD | ||
3747 | if (g.OwnerID != AgentId) | ||
3748 | return; // Don't send updates for other people's HUDs | ||
3749 | } | ||
3750 | |||
3711 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); | 3751 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); |
3712 | 3752 | ||
3713 | lock (m_entityUpdates.SyncRoot) | 3753 | lock (m_entityUpdates.SyncRoot) |
@@ -3774,27 +3814,74 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3774 | 3814 | ||
3775 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race | 3815 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race |
3776 | // condition where a kill can be processed before an out-of-date update for the same object. | 3816 | // condition where a kill can be processed before an out-of-date update for the same object. |
3777 | lock (m_killRecord) | 3817 | float avgTimeDilation = 1.0f; |
3818 | IEntityUpdate iupdate; | ||
3819 | Int32 timeinqueue; // this is just debugging code & can be dropped later | ||
3820 | |||
3821 | while (updatesThisCall < maxUpdates) | ||
3778 | { | 3822 | { |
3779 | float avgTimeDilation = 1.0f; | 3823 | lock (m_entityUpdates.SyncRoot) |
3780 | IEntityUpdate iupdate; | 3824 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) |
3781 | Int32 timeinqueue; // this is just debugging code & can be dropped later | 3825 | break; |
3782 | 3826 | ||
3783 | while (updatesThisCall < maxUpdates) | 3827 | EntityUpdate update = (EntityUpdate)iupdate; |
3828 | |||
3829 | avgTimeDilation += update.TimeDilation; | ||
3830 | avgTimeDilation *= 0.5f; | ||
3831 | |||
3832 | if (update.Entity is SceneObjectPart) | ||
3784 | { | 3833 | { |
3785 | lock (m_entityUpdates.SyncRoot) | 3834 | SceneObjectPart part = (SceneObjectPart)update.Entity; |
3786 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) | ||
3787 | break; | ||
3788 | 3835 | ||
3789 | EntityUpdate update = (EntityUpdate)iupdate; | 3836 | if (part.ParentGroup.IsDeleted) |
3790 | 3837 | continue; | |
3791 | avgTimeDilation += update.TimeDilation; | ||
3792 | avgTimeDilation *= 0.5f; | ||
3793 | 3838 | ||
3794 | if (update.Entity is SceneObjectPart) | 3839 | if (part.ParentGroup.IsAttachment) |
3840 | { // Someone else's HUD, why are we getting these? | ||
3841 | if (part.ParentGroup.OwnerID != AgentId && | ||
3842 | part.ParentGroup.RootPart.Shape.State > 30) | ||
3843 | continue; | ||
3844 | ScenePresence sp; | ||
3845 | // Owner is not in the sim, don't update it to | ||
3846 | // anyone | ||
3847 | if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) | ||
3848 | continue; | ||
3849 | |||
3850 | List<SceneObjectGroup> atts = sp.GetAttachments(); | ||
3851 | bool found = false; | ||
3852 | foreach (SceneObjectGroup att in atts) | ||
3853 | { | ||
3854 | if (att == part.ParentGroup) | ||
3855 | { | ||
3856 | found = true; | ||
3857 | break; | ||
3858 | } | ||
3859 | } | ||
3860 | |||
3861 | // It's an attachment of a valid avatar, but | ||
3862 | // doesn't seem to be attached, skip | ||
3863 | if (!found) | ||
3864 | continue; | ||
3865 | |||
3866 | // On vehicle crossing, the attachments are received | ||
3867 | // while the avatar is still a child. Don't send | ||
3868 | // updates here because the LocalId has not yet | ||
3869 | // been updated and the viewer will derender the | ||
3870 | // attachments until the avatar becomes root. | ||
3871 | if (sp.IsChildAgent) | ||
3872 | continue; | ||
3873 | |||
3874 | // If the object is an attachment we don't want it to be in the kill | ||
3875 | // record. Else attaching from inworld and subsequently dropping | ||
3876 | // it will no longer work. | ||
3877 | // lock (m_killRecord) | ||
3878 | // { | ||
3879 | // m_killRecord.Remove(part.LocalId); | ||
3880 | // m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); | ||
3881 | // } | ||
3882 | } | ||
3883 | else | ||
3795 | { | 3884 | { |
3796 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3797 | |||
3798 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client | 3885 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client |
3799 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good | 3886 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good |
3800 | // safety measure. | 3887 | // safety measure. |
@@ -3805,21 +3892,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3805 | // | 3892 | // |
3806 | // This doesn't appear to apply to child prims - a client will happily ignore these updates | 3893 | // This doesn't appear to apply to child prims - a client will happily ignore these updates |
3807 | // after the root prim has been deleted. | 3894 | // after the root prim has been deleted. |
3808 | if (m_killRecord.Contains(part.LocalId)) | 3895 | // |
3809 | { | 3896 | // We ignore this for attachments because attaching something from inworld breaks unless we do. |
3810 | // m_log.WarnFormat( | 3897 | // lock (m_killRecord) |
3811 | // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", | 3898 | // { |
3812 | // part.LocalId, Name); | 3899 | // if (m_killRecord.Contains(part.LocalId)) |
3813 | continue; | 3900 | // continue; |
3814 | } | 3901 | // if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) |
3815 | 3902 | // continue; | |
3816 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | 3903 | // } |
3904 | } | ||
3905 | |||
3906 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | ||
3907 | { | ||
3908 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | ||
3909 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3817 | { | 3910 | { |
3818 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | 3911 | part.Shape.LightEntry = false; |
3819 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3820 | { | ||
3821 | part.Shape.LightEntry = false; | ||
3822 | } | ||
3823 | } | 3912 | } |
3824 | 3913 | ||
3825 | if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) | 3914 | if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) |
@@ -3830,224 +3919,166 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3830 | part.Shape.ProfileHollow = 27500; | 3919 | part.Shape.ProfileHollow = 27500; |
3831 | } | 3920 | } |
3832 | } | 3921 | } |
3833 | 3922 | ||
3834 | #region UpdateFlags to packet type conversion | 3923 | if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) |
3835 | |||
3836 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | ||
3837 | |||
3838 | bool canUseCompressed = true; | ||
3839 | bool canUseImproved = true; | ||
3840 | |||
3841 | // Compressed object updates only make sense for LL primitives | ||
3842 | if (!(update.Entity is SceneObjectPart)) | ||
3843 | { | 3924 | { |
3844 | canUseCompressed = false; | 3925 | // Ensure that mesh has at least 8 valid faces |
3926 | part.Shape.ProfileBegin = 12500; | ||
3927 | part.Shape.ProfileEnd = 0; | ||
3928 | part.Shape.ProfileHollow = 27500; | ||
3845 | } | 3929 | } |
3846 | 3930 | } | |
3847 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | 3931 | |
3932 | ++updatesThisCall; | ||
3933 | |||
3934 | #region UpdateFlags to packet type conversion | ||
3935 | |||
3936 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | ||
3937 | |||
3938 | bool canUseCompressed = true; | ||
3939 | bool canUseImproved = true; | ||
3940 | |||
3941 | // Compressed object updates only make sense for LL primitives | ||
3942 | if (!(update.Entity is SceneObjectPart)) | ||
3943 | { | ||
3944 | canUseCompressed = false; | ||
3945 | } | ||
3946 | |||
3947 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | ||
3948 | { | ||
3949 | canUseCompressed = false; | ||
3950 | canUseImproved = false; | ||
3951 | } | ||
3952 | else | ||
3953 | { | ||
3954 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | ||
3955 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
3956 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3957 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3848 | { | 3958 | { |
3849 | canUseCompressed = false; | 3959 | canUseCompressed = false; |
3850 | canUseImproved = false; | ||
3851 | } | 3960 | } |
3852 | else | 3961 | |
3962 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
3963 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3964 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3965 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3966 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3967 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3968 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3969 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3970 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3971 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3972 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3973 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3974 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3975 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3853 | { | 3976 | { |
3854 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | 3977 | canUseImproved = false; |
3855 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
3856 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3857 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3858 | { | ||
3859 | canUseCompressed = false; | ||
3860 | } | ||
3861 | |||
3862 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
3863 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3864 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3865 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3866 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3867 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3868 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3869 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3870 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3871 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3872 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3873 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3874 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3875 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3876 | { | ||
3877 | canUseImproved = false; | ||
3878 | } | ||
3879 | } | 3978 | } |
3979 | } | ||
3880 | 3980 | ||
3881 | #endregion UpdateFlags to packet type conversion | 3981 | #endregion UpdateFlags to packet type conversion |
3882 | |||
3883 | #region Block Construction | ||
3884 | |||
3885 | // TODO: Remove this once we can build compressed updates | ||
3886 | canUseCompressed = false; | ||
3887 | |||
3888 | if (!canUseImproved && !canUseCompressed) | ||
3889 | { | ||
3890 | ObjectUpdatePacket.ObjectDataBlock updateBlock; | ||
3891 | 3982 | ||
3892 | if (update.Entity is ScenePresence) | 3983 | #region Block Construction |
3893 | { | ||
3894 | updateBlock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); | ||
3895 | } | ||
3896 | else | ||
3897 | { | ||
3898 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3899 | updateBlock = CreatePrimUpdateBlock(part, AgentId); | ||
3900 | |||
3901 | // If the part has become a private hud since the update was scheduled then we do not | ||
3902 | // want to send it to other avatars. | ||
3903 | if (part.ParentGroup.IsAttachment | ||
3904 | && part.ParentGroup.HasPrivateAttachmentPoint | ||
3905 | && part.ParentGroup.AttachedAvatar != AgentId) | ||
3906 | continue; | ||
3907 | |||
3908 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3909 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3910 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3911 | // of the test above). | ||
3912 | // | ||
3913 | // Actual deletions (kills) happen in another method. | ||
3914 | if (part.ParentGroup.IsDeleted) | ||
3915 | continue; | ||
3916 | } | ||
3917 | 3984 | ||
3918 | objectUpdateBlocks.Value.Add(updateBlock); | 3985 | // TODO: Remove this once we can build compressed updates |
3919 | objectUpdates.Value.Add(update); | 3986 | canUseCompressed = false; |
3920 | } | ||
3921 | else if (!canUseImproved) | ||
3922 | { | ||
3923 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3924 | ObjectUpdateCompressedPacket.ObjectDataBlock compressedBlock | ||
3925 | = CreateCompressedUpdateBlock(part, updateFlags); | ||
3926 | |||
3927 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3928 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3929 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3930 | // of the test above). | ||
3931 | // | ||
3932 | // Actual deletions (kills) happen in another method. | ||
3933 | if (part.ParentGroup.IsDeleted) | ||
3934 | continue; | ||
3935 | 3987 | ||
3936 | compressedUpdateBlocks.Value.Add(compressedBlock); | 3988 | if (!canUseImproved && !canUseCompressed) |
3937 | compressedUpdates.Value.Add(update); | 3989 | { |
3990 | if (update.Entity is ScenePresence) | ||
3991 | { | ||
3992 | objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); | ||
3938 | } | 3993 | } |
3939 | else | 3994 | else |
3940 | { | 3995 | { |
3941 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) | 3996 | objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); |
3942 | { | ||
3943 | // Self updates go into a special list | ||
3944 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3945 | terseAgentUpdates.Value.Add(update); | ||
3946 | } | ||
3947 | else | ||
3948 | { | ||
3949 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseUpdateBlock | ||
3950 | = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); | ||
3951 | |||
3952 | // Everything else goes here | ||
3953 | if (update.Entity is SceneObjectPart) | ||
3954 | { | ||
3955 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3956 | |||
3957 | // If the part has become a private hud since the update was scheduled then we do not | ||
3958 | // want to send it to other avatars. | ||
3959 | if (part.ParentGroup.IsAttachment | ||
3960 | && part.ParentGroup.HasPrivateAttachmentPoint | ||
3961 | && part.ParentGroup.AttachedAvatar != AgentId) | ||
3962 | continue; | ||
3963 | |||
3964 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3965 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3966 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3967 | // of the test above). | ||
3968 | // | ||
3969 | // Actual deletions (kills) happen in another method. | ||
3970 | if (part.ParentGroup.IsDeleted) | ||
3971 | continue; | ||
3972 | } | ||
3973 | |||
3974 | terseUpdateBlocks.Value.Add(terseUpdateBlock); | ||
3975 | terseUpdates.Value.Add(update); | ||
3976 | } | ||
3977 | } | 3997 | } |
3978 | |||
3979 | ++updatesThisCall; | ||
3980 | |||
3981 | #endregion Block Construction | ||
3982 | } | 3998 | } |
3983 | 3999 | else if (!canUseImproved) | |
3984 | #region Packet Sending | 4000 | { |
3985 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | 4001 | compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); |
3986 | 4002 | } | |
3987 | if (terseAgentUpdateBlocks.IsValueCreated) | 4003 | else |
3988 | { | 4004 | { |
3989 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | 4005 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) |
4006 | // Self updates go into a special list | ||
4007 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
4008 | else | ||
4009 | // Everything else goes here | ||
4010 | terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
4011 | } | ||
3990 | 4012 | ||
3991 | ImprovedTerseObjectUpdatePacket packet | 4013 | #endregion Block Construction |
3992 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); | 4014 | } |
3993 | 4015 | ||
3994 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4016 | #region Packet Sending |
3995 | packet.RegionData.TimeDilation = timeDilation; | 4017 | |
3996 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 4018 | const float TIME_DILATION = 1.0f; |
4019 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | ||
4020 | |||
4021 | if (terseAgentUpdateBlocks.IsValueCreated) | ||
4022 | { | ||
4023 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | ||
3997 | 4024 | ||
3998 | for (int i = 0; i < blocks.Count; i++) | 4025 | ImprovedTerseObjectUpdatePacket packet |
3999 | packet.ObjectData[i] = blocks[i]; | 4026 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); |
4000 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | 4027 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
4001 | OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); | 4028 | packet.RegionData.TimeDilation = timeDilation; |
4002 | } | 4029 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; |
4003 | 4030 | ||
4004 | if (objectUpdateBlocks.IsValueCreated) | 4031 | for (int i = 0; i < blocks.Count; i++) |
4005 | { | 4032 | packet.ObjectData[i] = blocks[i]; |
4006 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; | ||
4007 | |||
4008 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | ||
4009 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4010 | packet.RegionData.TimeDilation = timeDilation; | ||
4011 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4012 | |||
4013 | for (int i = 0; i < blocks.Count; i++) | ||
4014 | packet.ObjectData[i] = blocks[i]; | ||
4015 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
4016 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); | ||
4017 | } | ||
4018 | |||
4019 | if (compressedUpdateBlocks.IsValueCreated) | ||
4020 | { | ||
4021 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
4022 | |||
4023 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
4024 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4025 | packet.RegionData.TimeDilation = timeDilation; | ||
4026 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
4027 | |||
4028 | for (int i = 0; i < blocks.Count; i++) | ||
4029 | packet.ObjectData[i] = blocks[i]; | ||
4030 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
4031 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); | ||
4032 | } | ||
4033 | 4033 | ||
4034 | if (terseUpdateBlocks.IsValueCreated) | 4034 | OutPacket(packet, ThrottleOutPacketType.Unknown, true); |
4035 | { | 4035 | } |
4036 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
4037 | |||
4038 | ImprovedTerseObjectUpdatePacket packet | ||
4039 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
4040 | PacketType.ImprovedTerseObjectUpdate); | ||
4041 | 4036 | ||
4042 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4037 | if (objectUpdateBlocks.IsValueCreated) |
4043 | packet.RegionData.TimeDilation = timeDilation; | 4038 | { |
4044 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 4039 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; |
4045 | 4040 | ||
4046 | for (int i = 0; i < blocks.Count; i++) | 4041 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
4047 | packet.ObjectData[i] = blocks[i]; | 4042 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
4048 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | 4043 | packet.RegionData.TimeDilation = timeDilation; |
4049 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | 4044 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; |
4050 | } | 4045 | |
4046 | for (int i = 0; i < blocks.Count; i++) | ||
4047 | packet.ObjectData[i] = blocks[i]; | ||
4048 | |||
4049 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4050 | } | ||
4051 | |||
4052 | if (compressedUpdateBlocks.IsValueCreated) | ||
4053 | { | ||
4054 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
4055 | |||
4056 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
4057 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4058 | packet.RegionData.TimeDilation = timeDilation; | ||
4059 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
4060 | |||
4061 | for (int i = 0; i < blocks.Count; i++) | ||
4062 | packet.ObjectData[i] = blocks[i]; | ||
4063 | |||
4064 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4065 | } | ||
4066 | |||
4067 | if (terseUpdateBlocks.IsValueCreated) | ||
4068 | { | ||
4069 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
4070 | |||
4071 | ImprovedTerseObjectUpdatePacket packet | ||
4072 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
4073 | PacketType.ImprovedTerseObjectUpdate); | ||
4074 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4075 | packet.RegionData.TimeDilation = timeDilation; | ||
4076 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4077 | |||
4078 | for (int i = 0; i < blocks.Count; i++) | ||
4079 | packet.ObjectData[i] = blocks[i]; | ||
4080 | |||
4081 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | ||
4051 | } | 4082 | } |
4052 | 4083 | ||
4053 | #endregion Packet Sending | 4084 | #endregion Packet Sending |
@@ -4340,11 +4371,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4340 | 4371 | ||
4341 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties | 4372 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties |
4342 | // of the object rather than the properties when the packet was created | 4373 | // of the object rather than the properties when the packet was created |
4343 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4374 | // HACK : Remove intelligent resending until it's fixed in core |
4344 | delegate(OutgoingPacket oPacket) | 4375 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4345 | { | 4376 | // delegate(OutgoingPacket oPacket) |
4346 | ResendPropertyUpdates(updates, oPacket); | 4377 | // { |
4347 | }); | 4378 | // ResendPropertyUpdates(updates, oPacket); |
4379 | // }); | ||
4380 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4348 | 4381 | ||
4349 | // pbcnt += blocks.Count; | 4382 | // pbcnt += blocks.Count; |
4350 | // ppcnt++; | 4383 | // ppcnt++; |
@@ -4370,11 +4403,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4370 | // of the object rather than the properties when the packet was created | 4403 | // of the object rather than the properties when the packet was created |
4371 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); | 4404 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); |
4372 | updates.Add(familyUpdates.Value[i]); | 4405 | updates.Add(familyUpdates.Value[i]); |
4373 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4406 | // HACK : Remove intelligent resending until it's fixed in core |
4374 | delegate(OutgoingPacket oPacket) | 4407 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4375 | { | 4408 | // delegate(OutgoingPacket oPacket) |
4376 | ResendPropertyUpdates(updates, oPacket); | 4409 | // { |
4377 | }); | 4410 | // ResendPropertyUpdates(updates, oPacket); |
4411 | // }); | ||
4412 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4378 | 4413 | ||
4379 | // fpcnt++; | 4414 | // fpcnt++; |
4380 | // fbcnt++; | 4415 | // fbcnt++; |
@@ -4746,7 +4781,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4746 | 4781 | ||
4747 | if (landData.SimwideArea > 0) | 4782 | if (landData.SimwideArea > 0) |
4748 | { | 4783 | { |
4749 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 4784 | int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L); |
4785 | // Never report more than sim total capacity | ||
4786 | if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity) | ||
4787 | simulatorCapacity = m_scene.RegionInfo.ObjectCapacity; | ||
4750 | updateMessage.SimWideMaxPrims = simulatorCapacity; | 4788 | updateMessage.SimWideMaxPrims = simulatorCapacity; |
4751 | } | 4789 | } |
4752 | else | 4790 | else |
@@ -4875,14 +4913,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4875 | 4913 | ||
4876 | if (notifyCount > 0) | 4914 | if (notifyCount > 0) |
4877 | { | 4915 | { |
4878 | if (notifyCount > 32) | 4916 | // if (notifyCount > 32) |
4879 | { | 4917 | // { |
4880 | m_log.InfoFormat( | 4918 | // m_log.InfoFormat( |
4881 | "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" | 4919 | // "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" |
4882 | + " - a developer might want to investigate whether this is a hard limit", 32); | 4920 | // + " - a developer might want to investigate whether this is a hard limit", 32); |
4883 | 4921 | // | |
4884 | notifyCount = 32; | 4922 | // notifyCount = 32; |
4885 | } | 4923 | // } |
4886 | 4924 | ||
4887 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock | 4925 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock |
4888 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; | 4926 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; |
@@ -4937,9 +4975,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4937 | { | 4975 | { |
4938 | ScenePresence presence = (ScenePresence)entity; | 4976 | ScenePresence presence = (ScenePresence)entity; |
4939 | 4977 | ||
4978 | position = presence.OffsetPosition; | ||
4979 | rotation = presence.Rotation; | ||
4980 | |||
4981 | if (presence.ParentID != 0) | ||
4982 | { | ||
4983 | SceneObjectPart part = m_scene.GetSceneObjectPart(presence.ParentID); | ||
4984 | if (part != null && part != part.ParentGroup.RootPart) | ||
4985 | { | ||
4986 | position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; | ||
4987 | rotation = part.RotationOffset * presence.Rotation; | ||
4988 | } | ||
4989 | angularVelocity = Vector3.Zero; | ||
4990 | } | ||
4991 | else | ||
4992 | { | ||
4993 | angularVelocity = presence.AngularVelocity; | ||
4994 | rotation = presence.Rotation; | ||
4995 | } | ||
4996 | |||
4940 | attachPoint = 0; | 4997 | attachPoint = 0; |
4941 | collisionPlane = presence.CollisionPlane; | 4998 | collisionPlane = presence.CollisionPlane; |
4942 | position = presence.OffsetPosition; | ||
4943 | velocity = presence.Velocity; | 4999 | velocity = presence.Velocity; |
4944 | acceleration = Vector3.Zero; | 5000 | acceleration = Vector3.Zero; |
4945 | 5001 | ||
@@ -4948,9 +5004,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4948 | // may improve movement smoothness. | 5004 | // may improve movement smoothness. |
4949 | // acceleration = new Vector3(1, 0, 0); | 5005 | // acceleration = new Vector3(1, 0, 0); |
4950 | 5006 | ||
4951 | angularVelocity = presence.AngularVelocity; | ||
4952 | rotation = presence.Rotation; | ||
4953 | |||
4954 | if (sendTexture) | 5007 | if (sendTexture) |
4955 | textureEntry = presence.Appearance.Texture.GetBytes(); | 5008 | textureEntry = presence.Appearance.Texture.GetBytes(); |
4956 | else | 5009 | else |
@@ -5056,13 +5109,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5056 | 5109 | ||
5057 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) | 5110 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) |
5058 | { | 5111 | { |
5112 | Vector3 offsetPosition = data.OffsetPosition; | ||
5113 | Quaternion rotation = data.Rotation; | ||
5114 | uint parentID = data.ParentID; | ||
5115 | |||
5116 | if (parentID != 0) | ||
5117 | { | ||
5118 | SceneObjectPart part = m_scene.GetSceneObjectPart(parentID); | ||
5119 | if (part != null && part != part.ParentGroup.RootPart) | ||
5120 | { | ||
5121 | offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset; | ||
5122 | rotation = part.RotationOffset * data.Rotation; | ||
5123 | parentID = part.ParentGroup.RootPart.LocalId; | ||
5124 | } | ||
5125 | } | ||
5126 | |||
5059 | byte[] objectData = new byte[76]; | 5127 | byte[] objectData = new byte[76]; |
5060 | 5128 | ||
5061 | data.CollisionPlane.ToBytes(objectData, 0); | 5129 | data.CollisionPlane.ToBytes(objectData, 0); |
5062 | data.OffsetPosition.ToBytes(objectData, 16); | 5130 | offsetPosition.ToBytes(objectData, 16); |
5063 | // data.Velocity.ToBytes(objectData, 28); | 5131 | // data.Velocity.ToBytes(objectData, 28); |
5064 | // data.Acceleration.ToBytes(objectData, 40); | 5132 | // data.Acceleration.ToBytes(objectData, 40); |
5065 | data.Rotation.ToBytes(objectData, 52); | 5133 | rotation.ToBytes(objectData, 52); |
5066 | //data.AngularVelocity.ToBytes(objectData, 64); | 5134 | //data.AngularVelocity.ToBytes(objectData, 64); |
5067 | 5135 | ||
5068 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | 5136 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); |
@@ -5076,14 +5144,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5076 | update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + | 5144 | update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + |
5077 | data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); | 5145 | data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); |
5078 | update.ObjectData = objectData; | 5146 | update.ObjectData = objectData; |
5079 | update.ParentID = data.ParentID; | 5147 | update.ParentID = parentID; |
5080 | update.PathCurve = 16; | 5148 | update.PathCurve = 16; |
5081 | update.PathScaleX = 100; | 5149 | update.PathScaleX = 100; |
5082 | update.PathScaleY = 100; | 5150 | update.PathScaleY = 100; |
5083 | update.PCode = (byte)PCode.Avatar; | 5151 | update.PCode = (byte)PCode.Avatar; |
5084 | update.ProfileCurve = 1; | 5152 | update.ProfileCurve = 1; |
5085 | update.PSBlock = Utils.EmptyBytes; | 5153 | update.PSBlock = Utils.EmptyBytes; |
5086 | update.Scale = new Vector3(0.45f, 0.6f, 1.9f); | 5154 | update.Scale = data.Appearance.AvatarSize; |
5155 | // update.Scale.Z -= 0.2f; | ||
5156 | |||
5087 | update.Text = Utils.EmptyBytes; | 5157 | update.Text = Utils.EmptyBytes; |
5088 | update.TextColor = new byte[4]; | 5158 | update.TextColor = new byte[4]; |
5089 | 5159 | ||
@@ -5094,10 +5164,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5094 | update.TextureEntry = Utils.EmptyBytes; | 5164 | update.TextureEntry = Utils.EmptyBytes; |
5095 | // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; | 5165 | // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; |
5096 | 5166 | ||
5167 | /* all this flags seem related to prims and not avatars. This allow for wrong viewer side move of a avatar in prim edition mode (anv mantis 854) | ||
5097 | update.UpdateFlags = (uint)( | 5168 | update.UpdateFlags = (uint)( |
5098 | PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | | 5169 | PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | |
5099 | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | | 5170 | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | |
5100 | PrimFlags.ObjectOwnerModify); | 5171 | PrimFlags.ObjectOwnerModify); |
5172 | */ | ||
5173 | update.UpdateFlags = 0; | ||
5101 | 5174 | ||
5102 | return update; | 5175 | return update; |
5103 | } | 5176 | } |
@@ -5268,8 +5341,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5268 | // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs | 5341 | // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs |
5269 | // for each AgentUpdate packet. | 5342 | // for each AgentUpdate packet. |
5270 | AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); | 5343 | AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); |
5271 | 5344 | ||
5272 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); | 5345 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); |
5346 | AddLocalPacketHandler(PacketType.VelocityInterpolateOff, HandleVelocityInterpolateOff, false); | ||
5347 | AddLocalPacketHandler(PacketType.VelocityInterpolateOn, HandleVelocityInterpolateOn, false); | ||
5273 | AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); | 5348 | AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); |
5274 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); | 5349 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); |
5275 | AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); | 5350 | AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); |
@@ -5421,6 +5496,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5421 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); | 5496 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); |
5422 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); | 5497 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); |
5423 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); | 5498 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); |
5499 | AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments); | ||
5424 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); | 5500 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); |
5425 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); | 5501 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); |
5426 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); | 5502 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); |
@@ -5487,6 +5563,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5487 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); | 5563 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); |
5488 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); | 5564 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); |
5489 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); | 5565 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); |
5566 | AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags); | ||
5490 | 5567 | ||
5491 | AddGenericPacketHandler("autopilot", HandleAutopilot); | 5568 | AddGenericPacketHandler("autopilot", HandleAutopilot); |
5492 | } | 5569 | } |
@@ -5525,6 +5602,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5525 | (x.CameraLeftAxis != m_lastAgentUpdateArgs.CameraLeftAxis) || | 5602 | (x.CameraLeftAxis != m_lastAgentUpdateArgs.CameraLeftAxis) || |
5526 | (x.CameraUpAxis != m_lastAgentUpdateArgs.CameraUpAxis) || | 5603 | (x.CameraUpAxis != m_lastAgentUpdateArgs.CameraUpAxis) || |
5527 | (x.ControlFlags != m_lastAgentUpdateArgs.ControlFlags) || | 5604 | (x.ControlFlags != m_lastAgentUpdateArgs.ControlFlags) || |
5605 | (x.ControlFlags != 0) || | ||
5528 | (x.Far != m_lastAgentUpdateArgs.Far) || | 5606 | (x.Far != m_lastAgentUpdateArgs.Far) || |
5529 | (x.Flags != m_lastAgentUpdateArgs.Flags) || | 5607 | (x.Flags != m_lastAgentUpdateArgs.Flags) || |
5530 | (x.State != m_lastAgentUpdateArgs.State) || | 5608 | (x.State != m_lastAgentUpdateArgs.State) || |
@@ -5784,6 +5862,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5784 | return true; | 5862 | return true; |
5785 | } | 5863 | } |
5786 | 5864 | ||
5865 | private bool HandleVelocityInterpolateOff(IClientAPI sender, Packet Pack) | ||
5866 | { | ||
5867 | VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack; | ||
5868 | if (p.AgentData.SessionID != SessionId || | ||
5869 | p.AgentData.AgentID != AgentId) | ||
5870 | return true; | ||
5871 | |||
5872 | m_VelocityInterpolate = false; | ||
5873 | return true; | ||
5874 | } | ||
5875 | |||
5876 | private bool HandleVelocityInterpolateOn(IClientAPI sender, Packet Pack) | ||
5877 | { | ||
5878 | VelocityInterpolateOnPacket p = (VelocityInterpolateOnPacket)Pack; | ||
5879 | if (p.AgentData.SessionID != SessionId || | ||
5880 | p.AgentData.AgentID != AgentId) | ||
5881 | return true; | ||
5882 | |||
5883 | m_VelocityInterpolate = true; | ||
5884 | return true; | ||
5885 | } | ||
5886 | |||
5887 | |||
5787 | private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) | 5888 | private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) |
5788 | { | 5889 | { |
5789 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; | 5890 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; |
@@ -6204,26 +6305,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6204 | // Temporarily protect ourselves from the mantis #951 failure. | 6305 | // Temporarily protect ourselves from the mantis #951 failure. |
6205 | // However, we could do this for several other handlers where a failure isn't terminal | 6306 | // However, we could do this for several other handlers where a failure isn't terminal |
6206 | // for the client session anyway, in order to protect ourselves against bad code in plugins | 6307 | // for the client session anyway, in order to protect ourselves against bad code in plugins |
6308 | Vector3 avSize = appear.AgentData.Size; | ||
6207 | try | 6309 | try |
6208 | { | 6310 | { |
6209 | byte[] visualparams = new byte[appear.VisualParam.Length]; | 6311 | byte[] visualparams = new byte[appear.VisualParam.Length]; |
6210 | for (int i = 0; i < appear.VisualParam.Length; i++) | 6312 | for (int i = 0; i < appear.VisualParam.Length; i++) |
6211 | visualparams[i] = appear.VisualParam[i].ParamValue; | 6313 | visualparams[i] = appear.VisualParam[i].ParamValue; |
6212 | 6314 | //var b = appear.WearableData[0]; | |
6315 | |||
6213 | Primitive.TextureEntry te = null; | 6316 | Primitive.TextureEntry te = null; |
6214 | if (appear.ObjectData.TextureEntry.Length > 1) | 6317 | if (appear.ObjectData.TextureEntry.Length > 1) |
6215 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); | 6318 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); |
6319 | |||
6320 | WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; | ||
6321 | for (int i=0; i<appear.WearableData.Length;i++) | ||
6322 | cacheitems[i] = new WearableCacheItem(){CacheId = appear.WearableData[i].CacheID,TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)}; | ||
6216 | 6323 | ||
6217 | List<CachedTextureRequestArg> hashes = new List<CachedTextureRequestArg>(); | 6324 | |
6218 | for (int i = 0; i < appear.WearableData.Length; i++) | ||
6219 | { | ||
6220 | CachedTextureRequestArg arg = new CachedTextureRequestArg(); | ||
6221 | arg.BakedTextureIndex = appear.WearableData[i].TextureIndex; | ||
6222 | arg.WearableHashID = appear.WearableData[i].CacheID; | ||
6223 | hashes.Add(arg); | ||
6224 | } | ||
6225 | 6325 | ||
6226 | handlerSetAppearance(sender, te, visualparams, hashes); | 6326 | handlerSetAppearance(sender, te, visualparams,avSize, cacheitems); |
6227 | } | 6327 | } |
6228 | catch (Exception e) | 6328 | catch (Exception e) |
6229 | { | 6329 | { |
@@ -6432,6 +6532,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6432 | { | 6532 | { |
6433 | handlerCompleteMovementToRegion(sender, true); | 6533 | handlerCompleteMovementToRegion(sender, true); |
6434 | } | 6534 | } |
6535 | else | ||
6536 | m_log.Debug("HandleCompleteAgentMovement NULL handler"); | ||
6537 | |||
6435 | handlerCompleteMovementToRegion = null; | 6538 | handlerCompleteMovementToRegion = null; |
6436 | 6539 | ||
6437 | return true; | 6540 | return true; |
@@ -6449,7 +6552,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6449 | return true; | 6552 | return true; |
6450 | } | 6553 | } |
6451 | #endregion | 6554 | #endregion |
6452 | 6555 | /* | |
6453 | StartAnim handlerStartAnim = null; | 6556 | StartAnim handlerStartAnim = null; |
6454 | StopAnim handlerStopAnim = null; | 6557 | StopAnim handlerStopAnim = null; |
6455 | 6558 | ||
@@ -6473,6 +6576,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6473 | } | 6576 | } |
6474 | } | 6577 | } |
6475 | return true; | 6578 | return true; |
6579 | */ | ||
6580 | ChangeAnim handlerChangeAnim = null; | ||
6581 | |||
6582 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | ||
6583 | { | ||
6584 | handlerChangeAnim = OnChangeAnim; | ||
6585 | if (handlerChangeAnim != null) | ||
6586 | { | ||
6587 | handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false); | ||
6588 | } | ||
6589 | } | ||
6590 | |||
6591 | handlerChangeAnim = OnChangeAnim; | ||
6592 | if (handlerChangeAnim != null) | ||
6593 | { | ||
6594 | handlerChangeAnim(UUID.Zero, false, true); | ||
6595 | } | ||
6596 | |||
6597 | return true; | ||
6476 | } | 6598 | } |
6477 | 6599 | ||
6478 | private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) | 6600 | private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) |
@@ -6698,6 +6820,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6698 | #endregion | 6820 | #endregion |
6699 | 6821 | ||
6700 | m_udpClient.SetThrottles(atpack.Throttle.Throttles); | 6822 | m_udpClient.SetThrottles(atpack.Throttle.Throttles); |
6823 | GenericCall2 handler = OnUpdateThrottles; | ||
6824 | if (handler != null) | ||
6825 | { | ||
6826 | handler(); | ||
6827 | } | ||
6701 | return true; | 6828 | return true; |
6702 | } | 6829 | } |
6703 | 6830 | ||
@@ -7122,7 +7249,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7122 | physdata.Bounce = phsblock.Restitution; | 7249 | physdata.Bounce = phsblock.Restitution; |
7123 | physdata.Density = phsblock.Density; | 7250 | physdata.Density = phsblock.Density; |
7124 | physdata.Friction = phsblock.Friction; | 7251 | physdata.Friction = phsblock.Friction; |
7125 | physdata.GravitationModifier = phsblock.GravityMultiplier; | 7252 | physdata.GravitationModifier = phsblock.GravityMultiplier; |
7126 | } | 7253 | } |
7127 | 7254 | ||
7128 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); | 7255 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); |
@@ -7708,6 +7835,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7708 | // surrounding scene | 7835 | // surrounding scene |
7709 | if ((ImageType)block.Type == ImageType.Baked) | 7836 | if ((ImageType)block.Type == ImageType.Baked) |
7710 | args.Priority *= 2.0f; | 7837 | args.Priority *= 2.0f; |
7838 | int wearableout = 0; | ||
7711 | 7839 | ||
7712 | ImageManager.EnqueueReq(args); | 7840 | ImageManager.EnqueueReq(args); |
7713 | } | 7841 | } |
@@ -8726,16 +8854,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8726 | 8854 | ||
8727 | #region Parcel related packets | 8855 | #region Parcel related packets |
8728 | 8856 | ||
8857 | // acumulate several HandleRegionHandleRequest consecutive overlaping requests | ||
8858 | // to be done with minimal resources as possible | ||
8859 | // variables temporary here while in test | ||
8860 | |||
8861 | Queue<UUID> RegionHandleRequests = new Queue<UUID>(); | ||
8862 | bool RegionHandleRequestsInService = false; | ||
8863 | |||
8729 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) | 8864 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) |
8730 | { | 8865 | { |
8731 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | 8866 | UUID currentUUID; |
8732 | 8867 | ||
8733 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; | 8868 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; |
8734 | if (handlerRegionHandleRequest != null) | 8869 | |
8870 | if (handlerRegionHandleRequest == null) | ||
8871 | return true; | ||
8872 | |||
8873 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | ||
8874 | |||
8875 | lock (RegionHandleRequests) | ||
8735 | { | 8876 | { |
8736 | handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); | 8877 | if (RegionHandleRequestsInService) |
8878 | { | ||
8879 | // we are already busy doing a previus request | ||
8880 | // so enqueue it | ||
8881 | RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID); | ||
8882 | return true; | ||
8883 | } | ||
8884 | |||
8885 | // else do it | ||
8886 | currentUUID = rhrPack.RequestBlock.RegionID; | ||
8887 | RegionHandleRequestsInService = true; | ||
8737 | } | 8888 | } |
8738 | return true; | 8889 | |
8890 | while (true) | ||
8891 | { | ||
8892 | handlerRegionHandleRequest(this, currentUUID); | ||
8893 | |||
8894 | lock (RegionHandleRequests) | ||
8895 | { | ||
8896 | // exit condition, nothing to do or closed | ||
8897 | // current code seems to assume we may loose the handler at anytime, | ||
8898 | // so keep checking it | ||
8899 | handlerRegionHandleRequest = OnRegionHandleRequest; | ||
8900 | |||
8901 | if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null) | ||
8902 | { | ||
8903 | RegionHandleRequests.Clear(); | ||
8904 | RegionHandleRequestsInService = false; | ||
8905 | return true; | ||
8906 | } | ||
8907 | currentUUID = RegionHandleRequests.Dequeue(); | ||
8908 | } | ||
8909 | } | ||
8910 | |||
8911 | return true; // actually unreached | ||
8739 | } | 8912 | } |
8740 | 8913 | ||
8741 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) | 8914 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) |
@@ -9991,7 +10164,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9991 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, | 10164 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, |
9992 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), | 10165 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), |
9993 | UpdateMuteListEntry.MuteData.MuteType, | 10166 | UpdateMuteListEntry.MuteData.MuteType, |
9994 | UpdateMuteListEntry.AgentData.AgentID); | 10167 | UpdateMuteListEntry.MuteData.MuteFlags); |
9995 | return true; | 10168 | return true; |
9996 | } | 10169 | } |
9997 | return false; | 10170 | return false; |
@@ -10006,8 +10179,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10006 | { | 10179 | { |
10007 | handlerRemoveMuteListEntry(this, | 10180 | handlerRemoveMuteListEntry(this, |
10008 | RemoveMuteListEntry.MuteData.MuteID, | 10181 | RemoveMuteListEntry.MuteData.MuteID, |
10009 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), | 10182 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName)); |
10010 | RemoveMuteListEntry.AgentData.AgentID); | ||
10011 | return true; | 10183 | return true; |
10012 | } | 10184 | } |
10013 | return false; | 10185 | return false; |
@@ -10051,10 +10223,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10051 | return false; | 10223 | return false; |
10052 | } | 10224 | } |
10053 | 10225 | ||
10226 | private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet) | ||
10227 | { | ||
10228 | ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags = | ||
10229 | (ChangeInventoryItemFlagsPacket)packet; | ||
10230 | ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags; | ||
10231 | if (handlerChangeInventoryItemFlags != null) | ||
10232 | { | ||
10233 | foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData) | ||
10234 | handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags); | ||
10235 | return true; | ||
10236 | } | ||
10237 | return false; | ||
10238 | } | ||
10239 | |||
10054 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) | 10240 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) |
10055 | { | 10241 | { |
10056 | return true; | 10242 | return true; |
10057 | } | 10243 | } |
10244 | |||
10245 | private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack) | ||
10246 | { | ||
10247 | CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack; | ||
10248 | |||
10249 | #region Packet Session and User Check | ||
10250 | if (m_checkPackets) | ||
10251 | { | ||
10252 | if (packet.AgentData.SessionID != SessionId || | ||
10253 | packet.AgentData.AgentID != AgentId) | ||
10254 | return true; | ||
10255 | } | ||
10256 | #endregion | ||
10257 | MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null; | ||
10258 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
10259 | foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData) | ||
10260 | { | ||
10261 | InventoryItemBase b = new InventoryItemBase(); | ||
10262 | b.ID = n.OldItemID; | ||
10263 | b.Folder = n.OldFolderID; | ||
10264 | items.Add(b); | ||
10265 | } | ||
10266 | |||
10267 | handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy; | ||
10268 | if (handlerMoveItemsAndLeaveCopy != null) | ||
10269 | { | ||
10270 | handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID); | ||
10271 | } | ||
10272 | |||
10273 | return true; | ||
10274 | } | ||
10058 | 10275 | ||
10059 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) | 10276 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) |
10060 | { | 10277 | { |
@@ -10481,6 +10698,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10481 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; | 10698 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; |
10482 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; | 10699 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; |
10483 | 10700 | ||
10701 | Scene scene = (Scene)m_scene; | ||
10702 | if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID))) | ||
10703 | { | ||
10704 | ScenePresence p; | ||
10705 | if (scene.TryGetScenePresence(sender.AgentId, out p)) | ||
10706 | { | ||
10707 | if (p.GodLevel >= 200) | ||
10708 | { | ||
10709 | groupProfileReply.GroupData.OpenEnrollment = true; | ||
10710 | groupProfileReply.GroupData.MembershipFee = 0; | ||
10711 | } | ||
10712 | } | ||
10713 | } | ||
10714 | |||
10484 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); | 10715 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); |
10485 | } | 10716 | } |
10486 | return true; | 10717 | return true; |
@@ -11054,11 +11285,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11054 | 11285 | ||
11055 | StartLure handlerStartLure = OnStartLure; | 11286 | StartLure handlerStartLure = OnStartLure; |
11056 | if (handlerStartLure != null) | 11287 | if (handlerStartLure != null) |
11057 | handlerStartLure(startLureRequest.Info.LureType, | 11288 | { |
11058 | Utils.BytesToString( | 11289 | for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++) |
11059 | startLureRequest.Info.Message), | 11290 | { |
11060 | startLureRequest.TargetData[0].TargetID, | 11291 | handlerStartLure(startLureRequest.Info.LureType, |
11061 | this); | 11292 | Utils.BytesToString( |
11293 | startLureRequest.Info.Message), | ||
11294 | startLureRequest.TargetData[i].TargetID, | ||
11295 | this); | ||
11296 | } | ||
11297 | } | ||
11062 | return true; | 11298 | return true; |
11063 | } | 11299 | } |
11064 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) | 11300 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) |
@@ -11172,10 +11408,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11172 | } | 11408 | } |
11173 | #endregion | 11409 | #endregion |
11174 | 11410 | ||
11175 | ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; | 11411 | ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; |
11176 | if (handlerClassifiedGodDelete != null) | 11412 | if (handlerClassifiedGodDelete != null) |
11177 | handlerClassifiedGodDelete( | 11413 | handlerClassifiedGodDelete( |
11178 | classifiedGodDelete.Data.ClassifiedID, | 11414 | classifiedGodDelete.Data.ClassifiedID, |
11415 | classifiedGodDelete.Data.QueryID, | ||
11179 | this); | 11416 | this); |
11180 | return true; | 11417 | return true; |
11181 | } | 11418 | } |
@@ -11478,12 +11715,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11478 | /// <param name="simclient"></param> | 11715 | /// <param name="simclient"></param> |
11479 | /// <param name="packet"></param> | 11716 | /// <param name="packet"></param> |
11480 | /// <returns></returns> | 11717 | /// <returns></returns> |
11481 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) | 11718 | // TODO: Convert old handler to use new method |
11719 | /*protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) | ||
11482 | { | 11720 | { |
11483 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; | 11721 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; |
11484 | 11722 | ||
11485 | if (cachedtex.AgentData.SessionID != SessionId) | 11723 | if (cachedtex.AgentData.SessionID != SessionId) |
11486 | return false; | 11724 | return false; |
11725 | |||
11487 | 11726 | ||
11488 | List<CachedTextureRequestArg> requestArgs = new List<CachedTextureRequestArg>(); | 11727 | List<CachedTextureRequestArg> requestArgs = new List<CachedTextureRequestArg>(); |
11489 | 11728 | ||
@@ -11496,23 +11735,173 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11496 | requestArgs.Add(arg); | 11735 | requestArgs.Add(arg); |
11497 | } | 11736 | } |
11498 | 11737 | ||
11499 | try | 11738 | CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest; |
11739 | if (handlerCachedTextureRequest != null) | ||
11500 | { | 11740 | { |
11501 | CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest; | 11741 | handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs); |
11502 | if (handlerCachedTextureRequest != null) | 11742 | } |
11743 | |||
11744 | return true; | ||
11745 | }*/ | ||
11746 | |||
11747 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) | ||
11748 | { | ||
11749 | //m_log.Debug("texture cached: " + packet.ToString()); | ||
11750 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; | ||
11751 | AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); | ||
11752 | |||
11753 | if (cachedtex.AgentData.SessionID != SessionId) | ||
11754 | return false; | ||
11755 | |||
11756 | |||
11757 | // TODO: don't create new blocks if recycling an old packet | ||
11758 | cachedresp.AgentData.AgentID = AgentId; | ||
11759 | cachedresp.AgentData.SessionID = m_sessionId; | ||
11760 | cachedresp.AgentData.SerialNum = m_cachedTextureSerial; | ||
11761 | m_cachedTextureSerial++; | ||
11762 | cachedresp.WearableData = | ||
11763 | new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; | ||
11764 | |||
11765 | //IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>(); | ||
11766 | // var item = fac.GetBakedTextureFaces(AgentId); | ||
11767 | //WearableCacheItem[] items = fac.GetCachedItems(AgentId); | ||
11768 | |||
11769 | IAssetService cache = m_scene.AssetService; | ||
11770 | IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | ||
11771 | //bakedTextureModule = null; | ||
11772 | int maxWearablesLoop = cachedtex.WearableData.Length; | ||
11773 | if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) | ||
11774 | maxWearablesLoop = AvatarWearable.MAX_WEARABLES; | ||
11775 | |||
11776 | if (bakedTextureModule != null && cache != null) | ||
11777 | { | ||
11778 | // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid | ||
11779 | |||
11780 | WearableCacheItem[] cacheItems = null; | ||
11781 | ScenePresence p = m_scene.GetScenePresence(AgentId); | ||
11782 | if (p.Appearance != null) | ||
11783 | if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) | ||
11784 | { | ||
11785 | try | ||
11786 | { | ||
11787 | cacheItems = bakedTextureModule.Get(AgentId); | ||
11788 | p.Appearance.WearableCacheItems = cacheItems; | ||
11789 | p.Appearance.WearableCacheItemsDirty = false; | ||
11790 | } | ||
11791 | |||
11792 | /* | ||
11793 | * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! | ||
11794 | * | ||
11795 | catch (System.Net.Sockets.SocketException) | ||
11796 | { | ||
11797 | cacheItems = null; | ||
11798 | } | ||
11799 | catch (WebException) | ||
11800 | { | ||
11801 | cacheItems = null; | ||
11802 | } | ||
11803 | catch (InvalidOperationException) | ||
11804 | { | ||
11805 | cacheItems = null; | ||
11806 | } */ | ||
11807 | catch (Exception) | ||
11808 | { | ||
11809 | cacheItems = null; | ||
11810 | } | ||
11811 | |||
11812 | } | ||
11813 | else if (p.Appearance.WearableCacheItems != null) | ||
11814 | { | ||
11815 | cacheItems = p.Appearance.WearableCacheItems; | ||
11816 | } | ||
11817 | |||
11818 | if (cache != null && cacheItems != null) | ||
11503 | { | 11819 | { |
11504 | handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs); | 11820 | foreach (WearableCacheItem item in cacheItems) |
11821 | { | ||
11822 | |||
11823 | if (cache.GetCached(item.TextureID.ToString()) == null) | ||
11824 | { | ||
11825 | item.TextureAsset.Temporary = true; | ||
11826 | cache.Store(item.TextureAsset); | ||
11827 | } | ||
11828 | |||
11829 | |||
11830 | } | ||
11831 | } | ||
11832 | |||
11833 | if (cacheItems != null) | ||
11834 | { | ||
11835 | |||
11836 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11837 | { | ||
11838 | WearableCacheItem item = | ||
11839 | WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems); | ||
11840 | |||
11841 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11842 | cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; | ||
11843 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11844 | if (item != null && cachedtex.WearableData[i].ID == item.CacheId) | ||
11845 | { | ||
11846 | |||
11847 | cachedresp.WearableData[i].TextureID = item.TextureID; | ||
11848 | } | ||
11849 | else | ||
11850 | { | ||
11851 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11852 | } | ||
11853 | } | ||
11854 | } | ||
11855 | else | ||
11856 | { | ||
11857 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11858 | { | ||
11859 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11860 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11861 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11862 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11863 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11864 | } | ||
11505 | } | 11865 | } |
11506 | } | 11866 | } |
11507 | catch (Exception e) | 11867 | else |
11508 | { | 11868 | { |
11509 | m_log.ErrorFormat("[CLIENT VIEW]: AgentTextureCached packet handler threw an exception, {0}", e); | 11869 | if (cache == null) |
11510 | return false; | 11870 | { |
11871 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11872 | { | ||
11873 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11874 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11875 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11876 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11877 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11878 | } | ||
11879 | } | ||
11880 | else | ||
11881 | { | ||
11882 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11883 | { | ||
11884 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11885 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11886 | |||
11887 | |||
11888 | |||
11889 | if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null) | ||
11890 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11891 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11892 | else | ||
11893 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11894 | // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11895 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11896 | } | ||
11897 | } | ||
11511 | } | 11898 | } |
11512 | 11899 | cachedresp.Header.Zerocoded = true; | |
11900 | OutPacket(cachedresp, ThrottleOutPacketType.Task); | ||
11901 | |||
11513 | return true; | 11902 | return true; |
11514 | } | 11903 | } |
11515 | 11904 | ||
11516 | /// <summary> | 11905 | /// <summary> |
11517 | /// Send a response back to a client when it asks the asset server (via the region server) if it has | 11906 | /// Send a response back to a client when it asks the asset server (via the region server) if it has |
11518 | /// its appearance texture cached. | 11907 | /// its appearance texture cached. |
@@ -11576,209 +11965,147 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11576 | } | 11965 | } |
11577 | else | 11966 | else |
11578 | { | 11967 | { |
11579 | // m_log.DebugFormat( | 11968 | ClientChangeObject updatehandler = onClientChangeObject; |
11580 | // "[CLIENT]: Processing block {0} type {1} for {2} {3}", | ||
11581 | // i, block.Type, part.Name, part.LocalId); | ||
11582 | 11969 | ||
11583 | // // Do this once since fetch parts creates a new array. | 11970 | if (updatehandler != null) |
11584 | // SceneObjectPart[] parts = part.ParentGroup.Parts; | 11971 | { |
11585 | // for (int j = 0; j < parts.Length; j++) | 11972 | ObjectChangeData udata = new ObjectChangeData(); |
11586 | // { | ||
11587 | // part.StoreUndoState(); | ||
11588 | // parts[j].IgnoreUndoUpdate = true; | ||
11589 | // } | ||
11590 | 11973 | ||
11591 | UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; | 11974 | /*ubit from ll JIRA: |
11975 | * 0x01 position | ||
11976 | * 0x02 rotation | ||
11977 | * 0x04 scale | ||
11978 | |||
11979 | * 0x08 LINK_SET | ||
11980 | * 0x10 UNIFORM for scale | ||
11981 | */ | ||
11592 | 11982 | ||
11593 | switch (block.Type) | 11983 | // translate to internal changes |
11594 | { | 11984 | // not all cases .. just the ones older code did |
11595 | case 1: | ||
11596 | Vector3 pos1 = new Vector3(block.Data, 0); | ||
11597 | 11985 | ||
11598 | UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11986 | switch (block.Type) |
11599 | if (handlerUpdatePrimSinglePosition != null) | 11987 | { |
11600 | { | 11988 | case 1: //change position sp |
11601 | // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 11989 | udata.position = new Vector3(block.Data, 0); |
11602 | handlerUpdatePrimSinglePosition(localId, pos1, this); | ||
11603 | } | ||
11604 | break; | ||
11605 | 11990 | ||
11606 | case 2: | 11991 | udata.change = ObjectChangeType.primP; |
11607 | Quaternion rot1 = new Quaternion(block.Data, 0, true); | 11992 | updatehandler(localId, udata, this); |
11993 | break; | ||
11608 | 11994 | ||
11609 | UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; | 11995 | case 2: // rotation sp |
11610 | if (handlerUpdatePrimSingleRotation != null) | 11996 | udata.rotation = new Quaternion(block.Data, 0, true); |
11611 | { | ||
11612 | // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W); | ||
11613 | handlerUpdatePrimSingleRotation(localId, rot1, this); | ||
11614 | } | ||
11615 | break; | ||
11616 | 11997 | ||
11617 | case 3: | 11998 | udata.change = ObjectChangeType.primR; |
11618 | Vector3 rotPos = new Vector3(block.Data, 0); | 11999 | updatehandler(localId, udata, this); |
11619 | Quaternion rot2 = new Quaternion(block.Data, 12, true); | 12000 | break; |
11620 | 12001 | ||
11621 | UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; | 12002 | case 3: // position plus rotation |
11622 | if (handlerUpdatePrimSingleRotationPosition != null) | 12003 | udata.position = new Vector3(block.Data, 0); |
11623 | { | 12004 | udata.rotation = new Quaternion(block.Data, 12, true); |
11624 | // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z); | ||
11625 | // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W); | ||
11626 | handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this); | ||
11627 | } | ||
11628 | break; | ||
11629 | 12005 | ||
11630 | case 4: | 12006 | udata.change = ObjectChangeType.primPR; |
11631 | case 20: | 12007 | updatehandler(localId, udata, this); |
11632 | Vector3 scale4 = new Vector3(block.Data, 0); | 12008 | break; |
11633 | 12009 | ||
11634 | UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; | 12010 | case 4: // scale sp |
11635 | if (handlerUpdatePrimScale != null) | 12011 | udata.scale = new Vector3(block.Data, 0); |
11636 | { | 12012 | udata.change = ObjectChangeType.primS; |
11637 | // m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z); | ||
11638 | handlerUpdatePrimScale(localId, scale4, this); | ||
11639 | } | ||
11640 | break; | ||
11641 | 12013 | ||
11642 | case 5: | 12014 | updatehandler(localId, udata, this); |
11643 | Vector3 scale1 = new Vector3(block.Data, 12); | 12015 | break; |
11644 | Vector3 pos11 = new Vector3(block.Data, 0); | ||
11645 | 12016 | ||
11646 | handlerUpdatePrimScale = OnUpdatePrimScale; | 12017 | case 0x14: // uniform scale sp |
11647 | if (handlerUpdatePrimScale != null) | 12018 | udata.scale = new Vector3(block.Data, 0); |
11648 | { | ||
11649 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11650 | handlerUpdatePrimScale(localId, scale1, this); | ||
11651 | 12019 | ||
11652 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 12020 | udata.change = ObjectChangeType.primUS; |
11653 | if (handlerUpdatePrimSinglePosition != null) | 12021 | updatehandler(localId, udata, this); |
11654 | { | 12022 | break; |
11655 | handlerUpdatePrimSinglePosition(localId, pos11, this); | ||
11656 | } | ||
11657 | } | ||
11658 | break; | ||
11659 | 12023 | ||
11660 | case 9: | 12024 | case 5: // scale and position sp |
11661 | Vector3 pos2 = new Vector3(block.Data, 0); | 12025 | udata.position = new Vector3(block.Data, 0); |
12026 | udata.scale = new Vector3(block.Data, 12); | ||
11662 | 12027 | ||
11663 | UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; | 12028 | udata.change = ObjectChangeType.primPS; |
12029 | updatehandler(localId, udata, this); | ||
12030 | break; | ||
11664 | 12031 | ||
11665 | if (handlerUpdateVector != null) | 12032 | case 0x15: //uniform scale and position |
11666 | { | 12033 | udata.position = new Vector3(block.Data, 0); |
11667 | handlerUpdateVector(localId, pos2, this); | 12034 | udata.scale = new Vector3(block.Data, 12); |
11668 | } | ||
11669 | break; | ||
11670 | 12035 | ||
11671 | case 10: | 12036 | udata.change = ObjectChangeType.primPUS; |
11672 | Quaternion rot3 = new Quaternion(block.Data, 0, true); | 12037 | updatehandler(localId, udata, this); |
12038 | break; | ||
11673 | 12039 | ||
11674 | UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; | 12040 | // now group related (bit 4) |
11675 | if (handlerUpdatePrimRotation != null) | 12041 | case 9: //( 8 + 1 )group position |
11676 | { | 12042 | udata.position = new Vector3(block.Data, 0); |
11677 | // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W); | ||
11678 | handlerUpdatePrimRotation(localId, rot3, this); | ||
11679 | } | ||
11680 | break; | ||
11681 | 12043 | ||
11682 | case 11: | 12044 | udata.change = ObjectChangeType.groupP; |
11683 | Vector3 pos3 = new Vector3(block.Data, 0); | 12045 | updatehandler(localId, udata, this); |
11684 | Quaternion rot4 = new Quaternion(block.Data, 12, true); | 12046 | break; |
11685 | 12047 | ||
11686 | handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; | 12048 | case 0x0A: // (8 + 2) group rotation |
11687 | if (handlerUpdatePrimGroupRotation != null) | 12049 | udata.rotation = new Quaternion(block.Data, 0, true); |
11688 | { | ||
11689 | // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
11690 | // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W); | ||
11691 | handlerUpdatePrimGroupRotation(localId, pos3, rot4, this); | ||
11692 | } | ||
11693 | break; | ||
11694 | case 12: | ||
11695 | case 28: | ||
11696 | Vector3 scale7 = new Vector3(block.Data, 0); | ||
11697 | 12050 | ||
11698 | UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | 12051 | udata.change = ObjectChangeType.groupR; |
11699 | if (handlerUpdatePrimGroupScale != null) | 12052 | updatehandler(localId, udata, this); |
11700 | { | 12053 | break; |
11701 | // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); | ||
11702 | handlerUpdatePrimGroupScale(localId, scale7, this); | ||
11703 | } | ||
11704 | break; | ||
11705 | 12054 | ||
11706 | case 13: | 12055 | case 0x0B: //( 8 + 2 + 1) group rotation and position |
11707 | Vector3 scale2 = new Vector3(block.Data, 12); | 12056 | udata.position = new Vector3(block.Data, 0); |
11708 | Vector3 pos4 = new Vector3(block.Data, 0); | 12057 | udata.rotation = new Quaternion(block.Data, 12, true); |
11709 | 12058 | ||
11710 | handlerUpdatePrimScale = OnUpdatePrimScale; | 12059 | udata.change = ObjectChangeType.groupPR; |
11711 | if (handlerUpdatePrimScale != null) | 12060 | updatehandler(localId, udata, this); |
11712 | { | 12061 | break; |
11713 | //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11714 | handlerUpdatePrimScale(localId, scale2, this); | ||
11715 | 12062 | ||
11716 | // Change the position based on scale (for bug number 246) | 12063 | case 0x0C: // (8 + 4) group scale |
11717 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 12064 | // only afects root prim and only sent by viewer editor object tab scaling |
11718 | // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 12065 | // mouse edition only allows uniform scaling |
11719 | if (handlerUpdatePrimSinglePosition != null) | 12066 | // SL MAY CHANGE THIS in viewers |
11720 | { | ||
11721 | handlerUpdatePrimSinglePosition(localId, pos4, this); | ||
11722 | } | ||
11723 | } | ||
11724 | break; | ||
11725 | 12067 | ||
11726 | case 29: | 12068 | udata.scale = new Vector3(block.Data, 0); |
11727 | Vector3 scale5 = new Vector3(block.Data, 12); | ||
11728 | Vector3 pos5 = new Vector3(block.Data, 0); | ||
11729 | 12069 | ||
11730 | handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | 12070 | udata.change = ObjectChangeType.groupS; |
11731 | if (handlerUpdatePrimGroupScale != null) | 12071 | updatehandler(localId, udata, this); |
11732 | { | ||
11733 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11734 | part.StoreUndoState(true); | ||
11735 | part.IgnoreUndoUpdate = true; | ||
11736 | handlerUpdatePrimGroupScale(localId, scale5, this); | ||
11737 | handlerUpdateVector = OnUpdatePrimGroupPosition; | ||
11738 | 12072 | ||
11739 | if (handlerUpdateVector != null) | 12073 | break; |
11740 | { | ||
11741 | handlerUpdateVector(localId, pos5, this); | ||
11742 | } | ||
11743 | 12074 | ||
11744 | part.IgnoreUndoUpdate = false; | 12075 | case 0x0D: //(8 + 4 + 1) group scale and position |
11745 | } | 12076 | // exception as above |
11746 | 12077 | ||
11747 | break; | 12078 | udata.position = new Vector3(block.Data, 0); |
12079 | udata.scale = new Vector3(block.Data, 12); | ||
11748 | 12080 | ||
11749 | case 21: | 12081 | udata.change = ObjectChangeType.groupPS; |
11750 | Vector3 scale6 = new Vector3(block.Data, 12); | 12082 | updatehandler(localId, udata, this); |
11751 | Vector3 pos6 = new Vector3(block.Data, 0); | 12083 | break; |
11752 | 12084 | ||
11753 | handlerUpdatePrimScale = OnUpdatePrimScale; | 12085 | case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM |
11754 | if (handlerUpdatePrimScale != null) | 12086 | udata.scale = new Vector3(block.Data, 0); |
11755 | { | ||
11756 | part.StoreUndoState(false); | ||
11757 | part.IgnoreUndoUpdate = true; | ||
11758 | 12087 | ||
11759 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | 12088 | udata.change = ObjectChangeType.groupUS; |
11760 | handlerUpdatePrimScale(localId, scale6, this); | 12089 | updatehandler(localId, udata, this); |
11761 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 12090 | break; |
11762 | if (handlerUpdatePrimSinglePosition != null) | ||
11763 | { | ||
11764 | handlerUpdatePrimSinglePosition(localId, pos6, this); | ||
11765 | } | ||
11766 | 12091 | ||
11767 | part.IgnoreUndoUpdate = false; | 12092 | case 0x1D: // (UNIFORM + GROUP + SCALE + POS) |
11768 | } | 12093 | udata.position = new Vector3(block.Data, 0); |
11769 | break; | 12094 | udata.scale = new Vector3(block.Data, 12); |
11770 | 12095 | ||
11771 | default: | 12096 | udata.change = ObjectChangeType.groupPUS; |
11772 | m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); | 12097 | updatehandler(localId, udata, this); |
11773 | break; | 12098 | break; |
12099 | |||
12100 | default: | ||
12101 | m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); | ||
12102 | break; | ||
12103 | } | ||
11774 | } | 12104 | } |
11775 | 12105 | ||
11776 | // for (int j = 0; j < parts.Length; j++) | ||
11777 | // parts[j].IgnoreUndoUpdate = false; | ||
11778 | } | 12106 | } |
11779 | } | 12107 | } |
11780 | } | 12108 | } |
11781 | |||
11782 | return true; | 12109 | return true; |
11783 | } | 12110 | } |
11784 | 12111 | ||
@@ -11839,9 +12166,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11839 | public void SetChildAgentThrottle(byte[] throttles) | 12166 | public void SetChildAgentThrottle(byte[] throttles) |
11840 | { | 12167 | { |
11841 | m_udpClient.SetThrottles(throttles); | 12168 | m_udpClient.SetThrottles(throttles); |
12169 | GenericCall2 handler = OnUpdateThrottles; | ||
12170 | if (handler != null) | ||
12171 | { | ||
12172 | handler(); | ||
12173 | } | ||
11842 | } | 12174 | } |
11843 | 12175 | ||
11844 | /// <summary> | 12176 | /// <summary> |
12177 | /// Sets the throttles from values supplied by the client | ||
12178 | /// </summary> | ||
12179 | /// <param name="throttles"></param> | ||
12180 | public void SetAgentThrottleSilent(int throttle, int setting) | ||
12181 | { | ||
12182 | m_udpClient.ForceThrottleSetting(throttle,setting); | ||
12183 | //m_udpClient.SetThrottles(throttles); | ||
12184 | |||
12185 | } | ||
12186 | |||
12187 | |||
12188 | /// <summary> | ||
11845 | /// Get the current throttles for this client as a packed byte array | 12189 | /// Get the current throttles for this client as a packed byte array |
11846 | /// </summary> | 12190 | /// </summary> |
11847 | /// <param name="multiplier">Unused</param> | 12191 | /// <param name="multiplier">Unused</param> |
@@ -12233,7 +12577,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12233 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", | 12577 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", |
12234 | // requestID, taskID, (SourceType)sourceType, Name); | 12578 | // requestID, taskID, (SourceType)sourceType, Name); |
12235 | 12579 | ||
12580 | |||
12581 | //Note, the bool returned from the below function is useless since it is always false. | ||
12236 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); | 12582 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); |
12583 | |||
12237 | } | 12584 | } |
12238 | 12585 | ||
12239 | /// <summary> | 12586 | /// <summary> |
@@ -12299,7 +12646,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12299 | /// <returns></returns> | 12646 | /// <returns></returns> |
12300 | private static int CalculateNumPackets(byte[] data) | 12647 | private static int CalculateNumPackets(byte[] data) |
12301 | { | 12648 | { |
12302 | const uint m_maxPacketSize = 600; | 12649 | // const uint m_maxPacketSize = 600; |
12650 | uint m_maxPacketSize = MaxTransferBytesPerPacket; | ||
12303 | int numPackets = 1; | 12651 | int numPackets = 1; |
12304 | 12652 | ||
12305 | if (data == null) | 12653 | if (data == null) |