diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
5 files changed, 947 insertions, 552 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index afbe56b..3995620 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | |||
@@ -234,6 +234,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
234 | m_stopPacket = TexturePacketCount(); | 234 | m_stopPacket = TexturePacketCount(); |
235 | } | 235 | } |
236 | 236 | ||
237 | //Give them at least two packets, to play nice with some broken viewers (SL also behaves this way) | ||
238 | if (m_stopPacket == 1 && m_layers[0].End > FIRST_PACKET_SIZE) m_stopPacket++; | ||
239 | |||
237 | m_currentPacket = StartPacket; | 240 | m_currentPacket = StartPacket; |
238 | } | 241 | } |
239 | } | 242 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0d4f09d..7686b94 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -99,6 +99,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
99 | public event AvatarPickerRequest OnAvatarPickerRequest; | 99 | public event AvatarPickerRequest OnAvatarPickerRequest; |
100 | public event StartAnim OnStartAnim; | 100 | public event StartAnim OnStartAnim; |
101 | public event StopAnim OnStopAnim; | 101 | public event StopAnim OnStopAnim; |
102 | public event ChangeAnim OnChangeAnim; | ||
102 | public event Action<IClientAPI> OnRequestAvatarsData; | 103 | public event Action<IClientAPI> OnRequestAvatarsData; |
103 | public event LinkObjects OnLinkObjects; | 104 | public event LinkObjects OnLinkObjects; |
104 | public event DelinkObjects OnDelinkObjects; | 105 | public event DelinkObjects OnDelinkObjects; |
@@ -126,6 +127,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
126 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; | 127 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; |
127 | public event UpdatePrimFlags OnUpdatePrimFlags; | 128 | public event UpdatePrimFlags OnUpdatePrimFlags; |
128 | public event UpdatePrimTexture OnUpdatePrimTexture; | 129 | public event UpdatePrimTexture OnUpdatePrimTexture; |
130 | public event ClientChangeObject onClientChangeObject; | ||
129 | public event UpdateVector OnUpdatePrimGroupPosition; | 131 | public event UpdateVector OnUpdatePrimGroupPosition; |
130 | public event UpdateVector OnUpdatePrimSinglePosition; | 132 | public event UpdateVector OnUpdatePrimSinglePosition; |
131 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | 133 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; |
@@ -159,6 +161,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
159 | public event RequestTaskInventory OnRequestTaskInventory; | 161 | public event RequestTaskInventory OnRequestTaskInventory; |
160 | public event UpdateInventoryItem OnUpdateInventoryItem; | 162 | public event UpdateInventoryItem OnUpdateInventoryItem; |
161 | public event CopyInventoryItem OnCopyInventoryItem; | 163 | public event CopyInventoryItem OnCopyInventoryItem; |
164 | public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | ||
162 | public event MoveInventoryItem OnMoveInventoryItem; | 165 | public event MoveInventoryItem OnMoveInventoryItem; |
163 | public event RemoveInventoryItem OnRemoveInventoryItem; | 166 | public event RemoveInventoryItem OnRemoveInventoryItem; |
164 | public event RemoveInventoryFolder OnRemoveInventoryFolder; | 167 | public event RemoveInventoryFolder OnRemoveInventoryFolder; |
@@ -257,7 +260,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
257 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; | 260 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; |
258 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | 261 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; |
259 | public event ClassifiedDelete OnClassifiedDelete; | 262 | public event ClassifiedDelete OnClassifiedDelete; |
260 | public event ClassifiedDelete OnClassifiedGodDelete; | 263 | public event ClassifiedGodDelete OnClassifiedGodDelete; |
261 | public event EventNotificationAddRequest OnEventNotificationAddRequest; | 264 | public event EventNotificationAddRequest OnEventNotificationAddRequest; |
262 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | 265 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; |
263 | public event EventGodDelete OnEventGodDelete; | 266 | public event EventGodDelete OnEventGodDelete; |
@@ -288,6 +291,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
288 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; | 291 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; |
289 | public event SimWideDeletesDelegate OnSimWideDeletes; | 292 | public event SimWideDeletesDelegate OnSimWideDeletes; |
290 | public event SendPostcard OnSendPostcard; | 293 | public event SendPostcard OnSendPostcard; |
294 | public event ChangeInventoryItemFlags OnChangeInventoryItemFlags; | ||
291 | public event MuteListEntryUpdate OnUpdateMuteListEntry; | 295 | public event MuteListEntryUpdate OnUpdateMuteListEntry; |
292 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 296 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
293 | public event GodlikeMessage onGodlikeMessage; | 297 | public event GodlikeMessage onGodlikeMessage; |
@@ -326,6 +330,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
326 | private Prioritizer m_prioritizer; | 330 | private Prioritizer m_prioritizer; |
327 | private bool m_disableFacelights = false; | 331 | private bool m_disableFacelights = false; |
328 | 332 | ||
333 | private const uint MaxTransferBytesPerPacket = 600; | ||
334 | |||
335 | |||
329 | /// <value> | 336 | /// <value> |
330 | /// List used in construction of data blocks for an object update packet. This is to stop us having to | 337 | /// List used in construction of data blocks for an object update packet. This is to stop us having to |
331 | /// continually recreate it. | 338 | /// continually recreate it. |
@@ -337,14 +344,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
337 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an | 344 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an |
338 | /// ownerless phantom. | 345 | /// ownerless phantom. |
339 | /// | 346 | /// |
340 | /// All manipulation of this set has to occur under a lock | 347 | /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock |
341 | /// | 348 | /// |
342 | /// </value> | 349 | /// </value> |
343 | protected HashSet<uint> m_killRecord; | 350 | // protected HashSet<uint> m_killRecord; |
344 | 351 | ||
345 | // protected HashSet<uint> m_attachmentsSent; | 352 | // protected HashSet<uint> m_attachmentsSent; |
346 | 353 | ||
347 | private int m_moneyBalance; | 354 | private int m_moneyBalance; |
355 | private bool m_deliverPackets = true; | ||
348 | private int m_animationSequenceNumber = 1; | 356 | private int m_animationSequenceNumber = 1; |
349 | private bool m_SendLogoutPacketWhenClosing = true; | 357 | private bool m_SendLogoutPacketWhenClosing = true; |
350 | private AgentUpdateArgs lastarg; | 358 | private AgentUpdateArgs lastarg; |
@@ -381,6 +389,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
381 | get { return m_startpos; } | 389 | get { return m_startpos; } |
382 | set { m_startpos = value; } | 390 | set { m_startpos = value; } |
383 | } | 391 | } |
392 | public bool DeliverPackets | ||
393 | { | ||
394 | get { return m_deliverPackets; } | ||
395 | set { | ||
396 | m_deliverPackets = value; | ||
397 | m_udpClient.m_deliverPackets = value; | ||
398 | } | ||
399 | } | ||
384 | public UUID AgentId { get { return m_agentId; } } | 400 | public UUID AgentId { get { return m_agentId; } } |
385 | public ISceneAgent SceneAgent { get; set; } | 401 | public ISceneAgent SceneAgent { get; set; } |
386 | public UUID ActiveGroupId { get { return m_activeGroupID; } } | 402 | public UUID ActiveGroupId { get { return m_activeGroupID; } } |
@@ -458,7 +474,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
458 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); | 474 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); |
459 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); | 475 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); |
460 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); | 476 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); |
461 | m_killRecord = new HashSet<uint>(); | 477 | // m_killRecord = new HashSet<uint>(); |
462 | // m_attachmentsSent = new HashSet<uint>(); | 478 | // m_attachmentsSent = new HashSet<uint>(); |
463 | 479 | ||
464 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | 480 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); |
@@ -488,12 +504,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
488 | 504 | ||
489 | #region Client Methods | 505 | #region Client Methods |
490 | 506 | ||
507 | |||
508 | /// <summary> | ||
509 | /// Close down the client view | ||
510 | /// </summary> | ||
491 | public void Close() | 511 | public void Close() |
492 | { | 512 | { |
493 | Close(false); | 513 | Close(true, false); |
494 | } | 514 | } |
495 | 515 | ||
496 | public void Close(bool force) | 516 | public void Close(bool sendStop, bool force) |
497 | { | 517 | { |
498 | // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. | 518 | // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. |
499 | // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. | 519 | // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. |
@@ -505,7 +525,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
505 | return; | 525 | return; |
506 | 526 | ||
507 | IsActive = false; | 527 | IsActive = false; |
508 | CloseWithoutChecks(); | 528 | CloseWithoutChecks(sendStop); |
509 | } | 529 | } |
510 | } | 530 | } |
511 | 531 | ||
@@ -518,12 +538,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
518 | /// | 538 | /// |
519 | /// Callers must lock ClosingSyncLock before calling. | 539 | /// Callers must lock ClosingSyncLock before calling. |
520 | /// </remarks> | 540 | /// </remarks> |
521 | public void CloseWithoutChecks() | 541 | public void CloseWithoutChecks(bool sendStop) |
522 | { | 542 | { |
523 | m_log.DebugFormat( | 543 | m_log.DebugFormat( |
524 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 544 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
525 | Name, m_scene.RegionInfo.RegionName); | 545 | Name, m_scene.RegionInfo.RegionName); |
526 | 546 | ||
547 | if (sendStop) | ||
548 | { | ||
549 | // Send the STOP packet | ||
550 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
551 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
552 | } | ||
553 | |||
527 | // Shutdown the image manager | 554 | // Shutdown the image manager |
528 | ImageManager.Close(); | 555 | ImageManager.Close(); |
529 | 556 | ||
@@ -781,7 +808,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
781 | handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); | 808 | handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); |
782 | handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; | 809 | handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; |
783 | 810 | ||
784 | OutPacket(handshake, ThrottleOutPacketType.Task); | 811 | // OutPacket(handshake, ThrottleOutPacketType.Task); |
812 | // use same as MoveAgentIntoRegion (both should be task ) | ||
813 | OutPacket(handshake, ThrottleOutPacketType.Unknown); | ||
785 | } | 814 | } |
786 | 815 | ||
787 | public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) | 816 | public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) |
@@ -820,7 +849,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
820 | reply.ChatData.OwnerID = fromAgentID; | 849 | reply.ChatData.OwnerID = fromAgentID; |
821 | reply.ChatData.SourceID = fromAgentID; | 850 | reply.ChatData.SourceID = fromAgentID; |
822 | 851 | ||
823 | OutPacket(reply, ThrottleOutPacketType.Task); | 852 | OutPacket(reply, ThrottleOutPacketType.Unknown); |
824 | } | 853 | } |
825 | 854 | ||
826 | /// <summary> | 855 | /// <summary> |
@@ -1106,6 +1135,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1106 | public virtual void SendLayerData(float[] map) | 1135 | public virtual void SendLayerData(float[] map) |
1107 | { | 1136 | { |
1108 | Util.FireAndForget(DoSendLayerData, map); | 1137 | Util.FireAndForget(DoSendLayerData, map); |
1138 | |||
1139 | // Send it sync, and async. It's not that much data | ||
1140 | // and it improves user experience just so much! | ||
1141 | DoSendLayerData(map); | ||
1109 | } | 1142 | } |
1110 | 1143 | ||
1111 | /// <summary> | 1144 | /// <summary> |
@@ -1118,16 +1151,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1118 | 1151 | ||
1119 | try | 1152 | try |
1120 | { | 1153 | { |
1121 | //for (int y = 0; y < 16; y++) | 1154 | for (int y = 0; y < 16; y++) |
1122 | //{ | 1155 | { |
1123 | // for (int x = 0; x < 16; x++) | 1156 | for (int x = 0; x < 16; x+=4) |
1124 | // { | 1157 | { |
1125 | // SendLayerData(x, y, map); | 1158 | SendLayerPacket(x, y, map); |
1126 | // } | 1159 | } |
1127 | //} | 1160 | } |
1128 | |||
1129 | // Send LayerData in a spiral pattern. Fun! | ||
1130 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
1131 | } | 1161 | } |
1132 | catch (Exception e) | 1162 | catch (Exception e) |
1133 | { | 1163 | { |
@@ -1135,51 +1165,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1135 | } | 1165 | } |
1136 | } | 1166 | } |
1137 | 1167 | ||
1138 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
1139 | { | ||
1140 | // Row | ||
1141 | for (int i = x1; i <= x2; i++) | ||
1142 | SendLayerData(i, y1, map); | ||
1143 | |||
1144 | // Column | ||
1145 | for (int j = y1 + 1; j <= y2; j++) | ||
1146 | SendLayerData(x2, j, map); | ||
1147 | |||
1148 | if (x2 - x1 > 0) | ||
1149 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
1150 | } | ||
1151 | |||
1152 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
1153 | { | ||
1154 | // Row in reverse | ||
1155 | for (int i = x2; i >= x1; i--) | ||
1156 | SendLayerData(i, y2, map); | ||
1157 | |||
1158 | // Column in reverse | ||
1159 | for (int j = y2 - 1; j >= y1; j--) | ||
1160 | SendLayerData(x1, j, map); | ||
1161 | |||
1162 | if (x2 - x1 > 0) | ||
1163 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
1164 | } | ||
1165 | |||
1166 | /// <summary> | 1168 | /// <summary> |
1167 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 1169 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
1168 | /// </summary> | 1170 | /// </summary> |
1169 | /// <param name="map">heightmap</param> | 1171 | /// <param name="map">heightmap</param> |
1170 | /// <param name="px">X coordinate for patches 0..12</param> | 1172 | /// <param name="px">X coordinate for patches 0..12</param> |
1171 | /// <param name="py">Y coordinate for patches 0..15</param> | 1173 | /// <param name="py">Y coordinate for patches 0..15</param> |
1172 | // private void SendLayerPacket(float[] map, int y, int x) | 1174 | private void SendLayerPacket(int x, int y, float[] map) |
1173 | // { | 1175 | { |
1174 | // int[] patches = new int[4]; | 1176 | int[] patches = new int[4]; |
1175 | // patches[0] = x + 0 + y * 16; | 1177 | patches[0] = x + 0 + y * 16; |
1176 | // patches[1] = x + 1 + y * 16; | 1178 | patches[1] = x + 1 + y * 16; |
1177 | // patches[2] = x + 2 + y * 16; | 1179 | patches[2] = x + 2 + y * 16; |
1178 | // patches[3] = x + 3 + y * 16; | 1180 | patches[3] = x + 3 + y * 16; |
1179 | 1181 | ||
1180 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 1182 | float[] heightmap = (map.Length == 65536) ? |
1181 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1183 | map : |
1182 | // } | 1184 | LLHeightFieldMoronize(map); |
1185 | |||
1186 | try | ||
1187 | { | ||
1188 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1189 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1190 | } | ||
1191 | catch | ||
1192 | { | ||
1193 | for (int px = x ; px < x + 4 ; px++) | ||
1194 | SendLayerData(px, y, map); | ||
1195 | } | ||
1196 | } | ||
1183 | 1197 | ||
1184 | /// <summary> | 1198 | /// <summary> |
1185 | /// Sends a specified patch to a client | 1199 | /// Sends a specified patch to a client |
@@ -1199,7 +1213,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1199 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 1213 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); |
1200 | layerpack.Header.Reliable = true; | 1214 | layerpack.Header.Reliable = true; |
1201 | 1215 | ||
1202 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1216 | OutPacket(layerpack, ThrottleOutPacketType.Task); |
1203 | } | 1217 | } |
1204 | catch (Exception e) | 1218 | catch (Exception e) |
1205 | { | 1219 | { |
@@ -1562,7 +1576,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1562 | 1576 | ||
1563 | public void SendKillObject(ulong regionHandle, List<uint> localIDs) | 1577 | public void SendKillObject(ulong regionHandle, List<uint> localIDs) |
1564 | { | 1578 | { |
1565 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); | 1579 | // foreach (uint id in localIDs) |
1580 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); | ||
1566 | 1581 | ||
1567 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); | 1582 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); |
1568 | // TODO: don't create new blocks if recycling an old packet | 1583 | // TODO: don't create new blocks if recycling an old packet |
@@ -1584,17 +1599,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1584 | // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race | 1599 | // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race |
1585 | // condition where a kill can be processed before an out-of-date update for the same object. | 1600 | // condition where a kill can be processed before an out-of-date update for the same object. |
1586 | // ProcessEntityUpdates() also takes the m_killRecord lock. | 1601 | // ProcessEntityUpdates() also takes the m_killRecord lock. |
1587 | lock (m_killRecord) | 1602 | // lock (m_killRecord) |
1588 | { | 1603 | // { |
1589 | foreach (uint localID in localIDs) | 1604 | // foreach (uint localID in localIDs) |
1590 | m_killRecord.Add(localID); | 1605 | // m_killRecord.Add(localID); |
1591 | 1606 | ||
1592 | // The throttle queue used here must match that being used for updates. Otherwise, there is a | 1607 | // The throttle queue used here must match that being used for updates. Otherwise, there is a |
1593 | // chance that a kill packet put on a separate queue will be sent to the client before an existing | 1608 | // chance that a kill packet put on a separate queue will be sent to the client before an existing |
1594 | // update packet on another queue. Receiving updates after kills results in unowned and undeletable | 1609 | // update packet on another queue. Receiving updates after kills results in unowned and undeletable |
1595 | // scene objects in a viewer until that viewer is relogged in. | 1610 | // scene objects in a viewer until that viewer is relogged in. |
1596 | OutPacket(kill, ThrottleOutPacketType.Task); | 1611 | OutPacket(kill, ThrottleOutPacketType.Task); |
1597 | } | 1612 | // } |
1598 | } | 1613 | } |
1599 | } | 1614 | } |
1600 | 1615 | ||
@@ -2052,9 +2067,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2052 | OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); | 2067 | OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); |
2053 | } | 2068 | } |
2054 | 2069 | ||
2055 | /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> | ||
2056 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) | 2070 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) |
2057 | { | 2071 | { |
2072 | SendInventoryItemCreateUpdate(Item, UUID.Zero, callbackId); | ||
2073 | } | ||
2074 | |||
2075 | /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> | ||
2076 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId) | ||
2077 | { | ||
2058 | const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; | 2078 | const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; |
2059 | 2079 | ||
2060 | UpdateCreateInventoryItemPacket InventoryReply | 2080 | UpdateCreateInventoryItemPacket InventoryReply |
@@ -2064,6 +2084,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2064 | // TODO: don't create new blocks if recycling an old packet | 2084 | // TODO: don't create new blocks if recycling an old packet |
2065 | InventoryReply.AgentData.AgentID = AgentId; | 2085 | InventoryReply.AgentData.AgentID = AgentId; |
2066 | InventoryReply.AgentData.SimApproved = true; | 2086 | InventoryReply.AgentData.SimApproved = true; |
2087 | InventoryReply.AgentData.TransactionID = transactionID; | ||
2067 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; | 2088 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; |
2068 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); | 2089 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); |
2069 | InventoryReply.InventoryData[0].ItemID = Item.ID; | 2090 | InventoryReply.InventoryData[0].ItemID = Item.ID; |
@@ -2133,16 +2154,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2133 | replytask.InventoryData.TaskID = taskID; | 2154 | replytask.InventoryData.TaskID = taskID; |
2134 | replytask.InventoryData.Serial = serial; | 2155 | replytask.InventoryData.Serial = serial; |
2135 | replytask.InventoryData.Filename = fileName; | 2156 | replytask.InventoryData.Filename = fileName; |
2136 | OutPacket(replytask, ThrottleOutPacketType.Asset); | 2157 | OutPacket(replytask, ThrottleOutPacketType.Task); |
2137 | } | 2158 | } |
2138 | 2159 | ||
2139 | public void SendXferPacket(ulong xferID, uint packet, byte[] data) | 2160 | public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) |
2140 | { | 2161 | { |
2162 | ThrottleOutPacketType type = ThrottleOutPacketType.Asset; | ||
2163 | if (isTaskInventory) | ||
2164 | type = ThrottleOutPacketType.Task; | ||
2165 | |||
2141 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); | 2166 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); |
2142 | sendXfer.XferID.ID = xferID; | 2167 | sendXfer.XferID.ID = xferID; |
2143 | sendXfer.XferID.Packet = packet; | 2168 | sendXfer.XferID.Packet = packet; |
2144 | sendXfer.DataPacket.Data = data; | 2169 | sendXfer.DataPacket.Data = data; |
2145 | OutPacket(sendXfer, ThrottleOutPacketType.Asset); | 2170 | OutPacket(sendXfer, type); |
2146 | } | 2171 | } |
2147 | 2172 | ||
2148 | public void SendAbortXferPacket(ulong xferID) | 2173 | public void SendAbortXferPacket(ulong xferID) |
@@ -2324,6 +2349,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2324 | OutPacket(sound, ThrottleOutPacketType.Task); | 2349 | OutPacket(sound, ThrottleOutPacketType.Task); |
2325 | } | 2350 | } |
2326 | 2351 | ||
2352 | public void SendTransferAbort(TransferRequestPacket transferRequest) | ||
2353 | { | ||
2354 | TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort); | ||
2355 | abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID; | ||
2356 | abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType; | ||
2357 | m_log.Debug("[Assets] Aborting transfer; asset request failed"); | ||
2358 | OutPacket(abort, ThrottleOutPacketType.Task); | ||
2359 | } | ||
2360 | |||
2327 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) | 2361 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) |
2328 | { | 2362 | { |
2329 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); | 2363 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); |
@@ -2616,6 +2650,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2616 | } | 2650 | } |
2617 | } | 2651 | } |
2618 | 2652 | ||
2653 | public void SendPartPhysicsProprieties(ISceneEntity entity) | ||
2654 | { | ||
2655 | SceneObjectPart part = (SceneObjectPart)entity; | ||
2656 | if (part != null && AgentId != UUID.Zero) | ||
2657 | { | ||
2658 | try | ||
2659 | { | ||
2660 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | ||
2661 | if (eq != null) | ||
2662 | { | ||
2663 | uint localid = part.LocalId; | ||
2664 | byte physshapetype = part.PhysicsShapeType; | ||
2665 | float density = part.Density; | ||
2666 | float friction = part.Friction; | ||
2667 | float bounce = part.Bounciness; | ||
2668 | float gravmod = part.GravityModifier; | ||
2669 | |||
2670 | eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); | ||
2671 | } | ||
2672 | } | ||
2673 | catch (Exception ex) | ||
2674 | { | ||
2675 | m_log.Error("Unable to send part Physics Proprieties - exception: " + ex.ToString()); | ||
2676 | } | ||
2677 | part.UpdatePhysRequired = false; | ||
2678 | } | ||
2679 | } | ||
2680 | |||
2681 | |||
2619 | 2682 | ||
2620 | public void SendGroupNameReply(UUID groupLLUID, string GroupName) | 2683 | public void SendGroupNameReply(UUID groupLLUID, string GroupName) |
2621 | { | 2684 | { |
@@ -2713,7 +2776,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2713 | else | 2776 | else |
2714 | { | 2777 | { |
2715 | int processedLength = 0; | 2778 | int processedLength = 0; |
2716 | int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; | 2779 | // int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; |
2780 | |||
2781 | int maxChunkSize = (int) MaxTransferBytesPerPacket; | ||
2717 | int packetNumber = 0; | 2782 | int packetNumber = 0; |
2718 | 2783 | ||
2719 | while (processedLength < req.AssetInf.Data.Length) | 2784 | while (processedLength < req.AssetInf.Data.Length) |
@@ -2784,7 +2849,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2784 | reply.Data.ParcelID = parcelID; | 2849 | reply.Data.ParcelID = parcelID; |
2785 | reply.Data.OwnerID = land.OwnerID; | 2850 | reply.Data.OwnerID = land.OwnerID; |
2786 | reply.Data.Name = Utils.StringToBytes(land.Name); | 2851 | reply.Data.Name = Utils.StringToBytes(land.Name); |
2787 | reply.Data.Desc = Utils.StringToBytes(land.Description); | 2852 | if (land != null && land.Description != null && land.Description != String.Empty) |
2853 | reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); | ||
2854 | else | ||
2855 | reply.Data.Desc = new Byte[0]; | ||
2788 | reply.Data.ActualArea = land.Area; | 2856 | reply.Data.ActualArea = land.Area; |
2789 | reply.Data.BillableArea = land.Area; // TODO: what is this? | 2857 | reply.Data.BillableArea = land.Area; // TODO: what is this? |
2790 | 2858 | ||
@@ -3519,7 +3587,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3519 | 3587 | ||
3520 | AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); | 3588 | AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); |
3521 | // TODO: don't create new blocks if recycling an old packet | 3589 | // TODO: don't create new blocks if recycling an old packet |
3522 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | 3590 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length]; |
3523 | avp.ObjectData.TextureEntry = textureEntry; | 3591 | avp.ObjectData.TextureEntry = textureEntry; |
3524 | 3592 | ||
3525 | AvatarAppearancePacket.VisualParamBlock avblock = null; | 3593 | AvatarAppearancePacket.VisualParamBlock avblock = null; |
@@ -3649,7 +3717,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3649 | /// </summary> | 3717 | /// </summary> |
3650 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) | 3718 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) |
3651 | { | 3719 | { |
3652 | //double priority = m_prioritizer.GetUpdatePriority(this, entity); | 3720 | if (entity is SceneObjectPart) |
3721 | { | ||
3722 | SceneObjectPart e = (SceneObjectPart)entity; | ||
3723 | SceneObjectGroup g = e.ParentGroup; | ||
3724 | if (g.RootPart.Shape.State > 30) // HUD | ||
3725 | if (g.OwnerID != AgentId) | ||
3726 | return; // Don't send updates for other people's HUDs | ||
3727 | } | ||
3728 | |||
3653 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); | 3729 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); |
3654 | 3730 | ||
3655 | lock (m_entityUpdates.SyncRoot) | 3731 | lock (m_entityUpdates.SyncRoot) |
@@ -3716,27 +3792,74 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3716 | 3792 | ||
3717 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race | 3793 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race |
3718 | // condition where a kill can be processed before an out-of-date update for the same object. | 3794 | // condition where a kill can be processed before an out-of-date update for the same object. |
3719 | lock (m_killRecord) | 3795 | float avgTimeDilation = 1.0f; |
3796 | IEntityUpdate iupdate; | ||
3797 | Int32 timeinqueue; // this is just debugging code & can be dropped later | ||
3798 | |||
3799 | while (updatesThisCall < maxUpdates) | ||
3720 | { | 3800 | { |
3721 | float avgTimeDilation = 1.0f; | 3801 | lock (m_entityUpdates.SyncRoot) |
3722 | IEntityUpdate iupdate; | 3802 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) |
3723 | Int32 timeinqueue; // this is just debugging code & can be dropped later | 3803 | break; |
3804 | |||
3805 | EntityUpdate update = (EntityUpdate)iupdate; | ||
3806 | |||
3807 | avgTimeDilation += update.TimeDilation; | ||
3808 | avgTimeDilation *= 0.5f; | ||
3724 | 3809 | ||
3725 | while (updatesThisCall < maxUpdates) | 3810 | if (update.Entity is SceneObjectPart) |
3726 | { | 3811 | { |
3727 | lock (m_entityUpdates.SyncRoot) | 3812 | SceneObjectPart part = (SceneObjectPart)update.Entity; |
3728 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) | ||
3729 | break; | ||
3730 | 3813 | ||
3731 | EntityUpdate update = (EntityUpdate)iupdate; | 3814 | if (part.ParentGroup.IsDeleted) |
3732 | 3815 | continue; | |
3733 | avgTimeDilation += update.TimeDilation; | ||
3734 | avgTimeDilation *= 0.5f; | ||
3735 | 3816 | ||
3736 | if (update.Entity is SceneObjectPart) | 3817 | if (part.ParentGroup.IsAttachment) |
3818 | { // Someone else's HUD, why are we getting these? | ||
3819 | if (part.ParentGroup.OwnerID != AgentId && | ||
3820 | part.ParentGroup.RootPart.Shape.State > 30) | ||
3821 | continue; | ||
3822 | ScenePresence sp; | ||
3823 | // Owner is not in the sim, don't update it to | ||
3824 | // anyone | ||
3825 | if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) | ||
3826 | continue; | ||
3827 | |||
3828 | List<SceneObjectGroup> atts = sp.GetAttachments(); | ||
3829 | bool found = false; | ||
3830 | foreach (SceneObjectGroup att in atts) | ||
3831 | { | ||
3832 | if (att == part.ParentGroup) | ||
3833 | { | ||
3834 | found = true; | ||
3835 | break; | ||
3836 | } | ||
3837 | } | ||
3838 | |||
3839 | // It's an attachment of a valid avatar, but | ||
3840 | // doesn't seem to be attached, skip | ||
3841 | if (!found) | ||
3842 | continue; | ||
3843 | |||
3844 | // On vehicle crossing, the attachments are received | ||
3845 | // while the avatar is still a child. Don't send | ||
3846 | // updates here because the LocalId has not yet | ||
3847 | // been updated and the viewer will derender the | ||
3848 | // attachments until the avatar becomes root. | ||
3849 | if (sp.IsChildAgent) | ||
3850 | continue; | ||
3851 | |||
3852 | // If the object is an attachment we don't want it to be in the kill | ||
3853 | // record. Else attaching from inworld and subsequently dropping | ||
3854 | // it will no longer work. | ||
3855 | // lock (m_killRecord) | ||
3856 | // { | ||
3857 | // m_killRecord.Remove(part.LocalId); | ||
3858 | // m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); | ||
3859 | // } | ||
3860 | } | ||
3861 | else | ||
3737 | { | 3862 | { |
3738 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3739 | |||
3740 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client | 3863 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client |
3741 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good | 3864 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good |
3742 | // safety measure. | 3865 | // safety measure. |
@@ -3747,241 +3870,177 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3747 | // | 3870 | // |
3748 | // This doesn't appear to apply to child prims - a client will happily ignore these updates | 3871 | // This doesn't appear to apply to child prims - a client will happily ignore these updates |
3749 | // after the root prim has been deleted. | 3872 | // after the root prim has been deleted. |
3750 | if (m_killRecord.Contains(part.LocalId)) | 3873 | // |
3751 | { | 3874 | // We ignore this for attachments because attaching something from inworld breaks unless we do. |
3752 | // m_log.WarnFormat( | 3875 | // lock (m_killRecord) |
3753 | // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", | 3876 | // { |
3754 | // part.LocalId, Name); | 3877 | // if (m_killRecord.Contains(part.LocalId)) |
3755 | continue; | 3878 | // continue; |
3756 | } | 3879 | // if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) |
3757 | 3880 | // continue; | |
3758 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | 3881 | // } |
3882 | } | ||
3883 | |||
3884 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | ||
3885 | { | ||
3886 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | ||
3887 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3759 | { | 3888 | { |
3760 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | 3889 | part.Shape.LightEntry = false; |
3761 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3762 | { | ||
3763 | part.Shape.LightEntry = false; | ||
3764 | } | ||
3765 | } | 3890 | } |
3766 | } | 3891 | } |
3767 | 3892 | } | |
3768 | #region UpdateFlags to packet type conversion | 3893 | |
3769 | 3894 | ++updatesThisCall; | |
3770 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | 3895 | |
3771 | 3896 | #region UpdateFlags to packet type conversion | |
3772 | bool canUseCompressed = true; | 3897 | |
3773 | bool canUseImproved = true; | 3898 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; |
3774 | 3899 | ||
3775 | // Compressed object updates only make sense for LL primitives | 3900 | bool canUseCompressed = true; |
3776 | if (!(update.Entity is SceneObjectPart)) | 3901 | bool canUseImproved = true; |
3902 | |||
3903 | // Compressed object updates only make sense for LL primitives | ||
3904 | if (!(update.Entity is SceneObjectPart)) | ||
3905 | { | ||
3906 | canUseCompressed = false; | ||
3907 | } | ||
3908 | |||
3909 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | ||
3910 | { | ||
3911 | canUseCompressed = false; | ||
3912 | canUseImproved = false; | ||
3913 | } | ||
3914 | else | ||
3915 | { | ||
3916 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | ||
3917 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
3918 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3919 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3777 | { | 3920 | { |
3778 | canUseCompressed = false; | 3921 | canUseCompressed = false; |
3779 | } | 3922 | } |
3780 | 3923 | ||
3781 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | 3924 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || |
3925 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3926 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3927 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3928 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3929 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3930 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3931 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3932 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3933 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3934 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3935 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3936 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3937 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3782 | { | 3938 | { |
3783 | canUseCompressed = false; | ||
3784 | canUseImproved = false; | 3939 | canUseImproved = false; |
3785 | } | 3940 | } |
3786 | else | 3941 | } |
3787 | { | ||
3788 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | ||
3789 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
3790 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3791 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3792 | { | ||
3793 | canUseCompressed = false; | ||
3794 | } | ||
3795 | |||
3796 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
3797 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3798 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3799 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3800 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3801 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3802 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3803 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3804 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3805 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3806 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3807 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3808 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3809 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3810 | { | ||
3811 | canUseImproved = false; | ||
3812 | } | ||
3813 | } | ||
3814 | |||
3815 | #endregion UpdateFlags to packet type conversion | ||
3816 | |||
3817 | #region Block Construction | ||
3818 | |||
3819 | // TODO: Remove this once we can build compressed updates | ||
3820 | canUseCompressed = false; | ||
3821 | 3942 | ||
3822 | if (!canUseImproved && !canUseCompressed) | 3943 | #endregion UpdateFlags to packet type conversion |
3823 | { | ||
3824 | ObjectUpdatePacket.ObjectDataBlock updateBlock; | ||
3825 | 3944 | ||
3826 | if (update.Entity is ScenePresence) | 3945 | #region Block Construction |
3827 | { | ||
3828 | updateBlock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); | ||
3829 | } | ||
3830 | else | ||
3831 | { | ||
3832 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3833 | updateBlock = CreatePrimUpdateBlock(part, AgentId); | ||
3834 | |||
3835 | // If the part has become a private hud since the update was scheduled then we do not | ||
3836 | // want to send it to other avatars. | ||
3837 | if (part.ParentGroup.IsAttachment | ||
3838 | && part.ParentGroup.HasPrivateAttachmentPoint | ||
3839 | && part.ParentGroup.AttachedAvatar != AgentId) | ||
3840 | continue; | ||
3841 | |||
3842 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3843 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3844 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3845 | // of the test above). | ||
3846 | // | ||
3847 | // Actual deletions (kills) happen in another method. | ||
3848 | if (part.ParentGroup.IsDeleted) | ||
3849 | continue; | ||
3850 | } | ||
3851 | 3946 | ||
3852 | objectUpdateBlocks.Value.Add(updateBlock); | 3947 | // TODO: Remove this once we can build compressed updates |
3853 | objectUpdates.Value.Add(update); | 3948 | canUseCompressed = false; |
3854 | } | ||
3855 | else if (!canUseImproved) | ||
3856 | { | ||
3857 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3858 | ObjectUpdateCompressedPacket.ObjectDataBlock compressedBlock | ||
3859 | = CreateCompressedUpdateBlock(part, updateFlags); | ||
3860 | |||
3861 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3862 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3863 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3864 | // of the test above). | ||
3865 | // | ||
3866 | // Actual deletions (kills) happen in another method. | ||
3867 | if (part.ParentGroup.IsDeleted) | ||
3868 | continue; | ||
3869 | 3949 | ||
3870 | compressedUpdateBlocks.Value.Add(compressedBlock); | 3950 | if (!canUseImproved && !canUseCompressed) |
3871 | compressedUpdates.Value.Add(update); | 3951 | { |
3952 | if (update.Entity is ScenePresence) | ||
3953 | { | ||
3954 | objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); | ||
3872 | } | 3955 | } |
3873 | else | 3956 | else |
3874 | { | 3957 | { |
3875 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) | 3958 | objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); |
3876 | { | ||
3877 | // Self updates go into a special list | ||
3878 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3879 | terseAgentUpdates.Value.Add(update); | ||
3880 | } | ||
3881 | else | ||
3882 | { | ||
3883 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseUpdateBlock | ||
3884 | = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); | ||
3885 | |||
3886 | // Everything else goes here | ||
3887 | if (update.Entity is SceneObjectPart) | ||
3888 | { | ||
3889 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3890 | |||
3891 | // If the part has become a private hud since the update was scheduled then we do not | ||
3892 | // want to send it to other avatars. | ||
3893 | if (part.ParentGroup.IsAttachment | ||
3894 | && part.ParentGroup.HasPrivateAttachmentPoint | ||
3895 | && part.ParentGroup.AttachedAvatar != AgentId) | ||
3896 | continue; | ||
3897 | |||
3898 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3899 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3900 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3901 | // of the test above). | ||
3902 | // | ||
3903 | // Actual deletions (kills) happen in another method. | ||
3904 | if (part.ParentGroup.IsDeleted) | ||
3905 | continue; | ||
3906 | } | ||
3907 | |||
3908 | terseUpdateBlocks.Value.Add(terseUpdateBlock); | ||
3909 | terseUpdates.Value.Add(update); | ||
3910 | } | ||
3911 | } | 3959 | } |
3912 | |||
3913 | ++updatesThisCall; | ||
3914 | |||
3915 | #endregion Block Construction | ||
3916 | } | 3960 | } |
3917 | 3961 | else if (!canUseImproved) | |
3918 | #region Packet Sending | 3962 | { |
3919 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | 3963 | compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); |
3920 | 3964 | } | |
3921 | if (terseAgentUpdateBlocks.IsValueCreated) | 3965 | else |
3922 | { | 3966 | { |
3923 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | 3967 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) |
3968 | // Self updates go into a special list | ||
3969 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3970 | else | ||
3971 | // Everything else goes here | ||
3972 | terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3973 | } | ||
3924 | 3974 | ||
3925 | ImprovedTerseObjectUpdatePacket packet | 3975 | #endregion Block Construction |
3926 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); | 3976 | } |
3927 | 3977 | ||
3928 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 3978 | #region Packet Sending |
3929 | packet.RegionData.TimeDilation = timeDilation; | 3979 | |
3930 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 3980 | const float TIME_DILATION = 1.0f; |
3981 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | ||
3982 | |||
3983 | if (terseAgentUpdateBlocks.IsValueCreated) | ||
3984 | { | ||
3985 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | ||
3931 | 3986 | ||
3932 | for (int i = 0; i < blocks.Count; i++) | 3987 | ImprovedTerseObjectUpdatePacket packet |
3933 | packet.ObjectData[i] = blocks[i]; | 3988 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); |
3934 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | 3989 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
3935 | OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); | 3990 | packet.RegionData.TimeDilation = timeDilation; |
3936 | } | 3991 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; |
3937 | 3992 | ||
3938 | if (objectUpdateBlocks.IsValueCreated) | 3993 | for (int i = 0; i < blocks.Count; i++) |
3939 | { | 3994 | packet.ObjectData[i] = blocks[i]; |
3940 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; | ||
3941 | |||
3942 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | ||
3943 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3944 | packet.RegionData.TimeDilation = timeDilation; | ||
3945 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
3946 | |||
3947 | for (int i = 0; i < blocks.Count; i++) | ||
3948 | packet.ObjectData[i] = blocks[i]; | ||
3949 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
3950 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); | ||
3951 | } | ||
3952 | |||
3953 | if (compressedUpdateBlocks.IsValueCreated) | ||
3954 | { | ||
3955 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
3956 | |||
3957 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
3958 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3959 | packet.RegionData.TimeDilation = timeDilation; | ||
3960 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
3961 | |||
3962 | for (int i = 0; i < blocks.Count; i++) | ||
3963 | packet.ObjectData[i] = blocks[i]; | ||
3964 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
3965 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); | ||
3966 | } | ||
3967 | 3995 | ||
3968 | if (terseUpdateBlocks.IsValueCreated) | 3996 | OutPacket(packet, ThrottleOutPacketType.Unknown, true); |
3969 | { | 3997 | } |
3970 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
3971 | |||
3972 | ImprovedTerseObjectUpdatePacket packet | ||
3973 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
3974 | PacketType.ImprovedTerseObjectUpdate); | ||
3975 | 3998 | ||
3976 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 3999 | if (objectUpdateBlocks.IsValueCreated) |
3977 | packet.RegionData.TimeDilation = timeDilation; | 4000 | { |
3978 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 4001 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; |
3979 | 4002 | ||
3980 | for (int i = 0; i < blocks.Count; i++) | 4003 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
3981 | packet.ObjectData[i] = blocks[i]; | 4004 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
3982 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | 4005 | packet.RegionData.TimeDilation = timeDilation; |
3983 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | 4006 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; |
3984 | } | 4007 | |
4008 | for (int i = 0; i < blocks.Count; i++) | ||
4009 | packet.ObjectData[i] = blocks[i]; | ||
4010 | |||
4011 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4012 | } | ||
4013 | |||
4014 | if (compressedUpdateBlocks.IsValueCreated) | ||
4015 | { | ||
4016 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
4017 | |||
4018 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
4019 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4020 | packet.RegionData.TimeDilation = timeDilation; | ||
4021 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
4022 | |||
4023 | for (int i = 0; i < blocks.Count; i++) | ||
4024 | packet.ObjectData[i] = blocks[i]; | ||
4025 | |||
4026 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4027 | } | ||
4028 | |||
4029 | if (terseUpdateBlocks.IsValueCreated) | ||
4030 | { | ||
4031 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
4032 | |||
4033 | ImprovedTerseObjectUpdatePacket packet | ||
4034 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
4035 | PacketType.ImprovedTerseObjectUpdate); | ||
4036 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4037 | packet.RegionData.TimeDilation = timeDilation; | ||
4038 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4039 | |||
4040 | for (int i = 0; i < blocks.Count; i++) | ||
4041 | packet.ObjectData[i] = blocks[i]; | ||
4042 | |||
4043 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | ||
3985 | } | 4044 | } |
3986 | 4045 | ||
3987 | #endregion Packet Sending | 4046 | #endregion Packet Sending |
@@ -4274,11 +4333,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4274 | 4333 | ||
4275 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties | 4334 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties |
4276 | // of the object rather than the properties when the packet was created | 4335 | // of the object rather than the properties when the packet was created |
4277 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4336 | // HACK : Remove intelligent resending until it's fixed in core |
4278 | delegate(OutgoingPacket oPacket) | 4337 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4279 | { | 4338 | // delegate(OutgoingPacket oPacket) |
4280 | ResendPropertyUpdates(updates, oPacket); | 4339 | // { |
4281 | }); | 4340 | // ResendPropertyUpdates(updates, oPacket); |
4341 | // }); | ||
4342 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4282 | 4343 | ||
4283 | // pbcnt += blocks.Count; | 4344 | // pbcnt += blocks.Count; |
4284 | // ppcnt++; | 4345 | // ppcnt++; |
@@ -4304,11 +4365,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4304 | // of the object rather than the properties when the packet was created | 4365 | // of the object rather than the properties when the packet was created |
4305 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); | 4366 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); |
4306 | updates.Add(familyUpdates.Value[i]); | 4367 | updates.Add(familyUpdates.Value[i]); |
4307 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4368 | // HACK : Remove intelligent resending until it's fixed in core |
4308 | delegate(OutgoingPacket oPacket) | 4369 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4309 | { | 4370 | // delegate(OutgoingPacket oPacket) |
4310 | ResendPropertyUpdates(updates, oPacket); | 4371 | // { |
4311 | }); | 4372 | // ResendPropertyUpdates(updates, oPacket); |
4373 | // }); | ||
4374 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4312 | 4375 | ||
4313 | // fpcnt++; | 4376 | // fpcnt++; |
4314 | // fbcnt++; | 4377 | // fbcnt++; |
@@ -4680,7 +4743,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4680 | 4743 | ||
4681 | if (landData.SimwideArea > 0) | 4744 | if (landData.SimwideArea > 0) |
4682 | { | 4745 | { |
4683 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 4746 | int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L); |
4747 | // Never report more than sim total capacity | ||
4748 | if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity) | ||
4749 | simulatorCapacity = m_scene.RegionInfo.ObjectCapacity; | ||
4684 | updateMessage.SimWideMaxPrims = simulatorCapacity; | 4750 | updateMessage.SimWideMaxPrims = simulatorCapacity; |
4685 | } | 4751 | } |
4686 | else | 4752 | else |
@@ -4809,14 +4875,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4809 | 4875 | ||
4810 | if (notifyCount > 0) | 4876 | if (notifyCount > 0) |
4811 | { | 4877 | { |
4812 | if (notifyCount > 32) | 4878 | // if (notifyCount > 32) |
4813 | { | 4879 | // { |
4814 | m_log.InfoFormat( | 4880 | // m_log.InfoFormat( |
4815 | "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" | 4881 | // "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" |
4816 | + " - a developer might want to investigate whether this is a hard limit", 32); | 4882 | // + " - a developer might want to investigate whether this is a hard limit", 32); |
4817 | 4883 | // | |
4818 | notifyCount = 32; | 4884 | // notifyCount = 32; |
4819 | } | 4885 | // } |
4820 | 4886 | ||
4821 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock | 4887 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock |
4822 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; | 4888 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; |
@@ -4871,9 +4937,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4871 | { | 4937 | { |
4872 | ScenePresence presence = (ScenePresence)entity; | 4938 | ScenePresence presence = (ScenePresence)entity; |
4873 | 4939 | ||
4940 | position = presence.OffsetPosition; | ||
4941 | rotation = presence.Rotation; | ||
4942 | |||
4943 | if (presence.ParentID != 0) | ||
4944 | { | ||
4945 | SceneObjectPart part = m_scene.GetSceneObjectPart(presence.ParentID); | ||
4946 | if (part != null && part != part.ParentGroup.RootPart) | ||
4947 | { | ||
4948 | position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; | ||
4949 | rotation = part.RotationOffset * presence.Rotation; | ||
4950 | } | ||
4951 | } | ||
4952 | |||
4874 | attachPoint = 0; | 4953 | attachPoint = 0; |
4875 | collisionPlane = presence.CollisionPlane; | 4954 | collisionPlane = presence.CollisionPlane; |
4876 | position = presence.OffsetPosition; | ||
4877 | velocity = presence.Velocity; | 4955 | velocity = presence.Velocity; |
4878 | acceleration = Vector3.Zero; | 4956 | acceleration = Vector3.Zero; |
4879 | 4957 | ||
@@ -4883,7 +4961,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4883 | // acceleration = new Vector3(1, 0, 0); | 4961 | // acceleration = new Vector3(1, 0, 0); |
4884 | 4962 | ||
4885 | angularVelocity = Vector3.Zero; | 4963 | angularVelocity = Vector3.Zero; |
4886 | rotation = presence.Rotation; | ||
4887 | 4964 | ||
4888 | if (sendTexture) | 4965 | if (sendTexture) |
4889 | textureEntry = presence.Appearance.Texture.GetBytes(); | 4966 | textureEntry = presence.Appearance.Texture.GetBytes(); |
@@ -4990,13 +5067,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4990 | 5067 | ||
4991 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) | 5068 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) |
4992 | { | 5069 | { |
5070 | Vector3 offsetPosition = data.OffsetPosition; | ||
5071 | Quaternion rotation = data.Rotation; | ||
5072 | uint parentID = data.ParentID; | ||
5073 | |||
5074 | if (parentID != 0) | ||
5075 | { | ||
5076 | SceneObjectPart part = m_scene.GetSceneObjectPart(parentID); | ||
5077 | if (part != null && part != part.ParentGroup.RootPart) | ||
5078 | { | ||
5079 | offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset; | ||
5080 | rotation = part.RotationOffset * data.Rotation; | ||
5081 | parentID = part.ParentGroup.RootPart.LocalId; | ||
5082 | } | ||
5083 | } | ||
5084 | |||
4993 | byte[] objectData = new byte[76]; | 5085 | byte[] objectData = new byte[76]; |
4994 | 5086 | ||
4995 | data.CollisionPlane.ToBytes(objectData, 0); | 5087 | data.CollisionPlane.ToBytes(objectData, 0); |
4996 | data.OffsetPosition.ToBytes(objectData, 16); | 5088 | offsetPosition.ToBytes(objectData, 16); |
4997 | // data.Velocity.ToBytes(objectData, 28); | 5089 | // data.Velocity.ToBytes(objectData, 28); |
4998 | // data.Acceleration.ToBytes(objectData, 40); | 5090 | // data.Acceleration.ToBytes(objectData, 40); |
4999 | data.Rotation.ToBytes(objectData, 52); | 5091 | rotation.ToBytes(objectData, 52); |
5000 | //data.AngularVelocity.ToBytes(objectData, 64); | 5092 | //data.AngularVelocity.ToBytes(objectData, 64); |
5001 | 5093 | ||
5002 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | 5094 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); |
@@ -5010,7 +5102,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5010 | update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + | 5102 | update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + |
5011 | data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); | 5103 | data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); |
5012 | update.ObjectData = objectData; | 5104 | update.ObjectData = objectData; |
5013 | update.ParentID = data.ParentID; | 5105 | update.ParentID = parentID; |
5014 | update.PathCurve = 16; | 5106 | update.PathCurve = 16; |
5015 | update.PathScaleX = 100; | 5107 | update.PathScaleX = 100; |
5016 | update.PathScaleY = 100; | 5108 | update.PathScaleY = 100; |
@@ -5028,10 +5120,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5028 | update.TextureEntry = Utils.EmptyBytes; | 5120 | update.TextureEntry = Utils.EmptyBytes; |
5029 | // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; | 5121 | // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; |
5030 | 5122 | ||
5123 | /* 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) | ||
5031 | update.UpdateFlags = (uint)( | 5124 | update.UpdateFlags = (uint)( |
5032 | PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | | 5125 | PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | |
5033 | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | | 5126 | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | |
5034 | PrimFlags.ObjectOwnerModify); | 5127 | PrimFlags.ObjectOwnerModify); |
5128 | */ | ||
5129 | update.UpdateFlags = 0; | ||
5035 | 5130 | ||
5036 | return update; | 5131 | return update; |
5037 | } | 5132 | } |
@@ -5351,6 +5446,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5351 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); | 5446 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); |
5352 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); | 5447 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); |
5353 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); | 5448 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); |
5449 | AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments); | ||
5354 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); | 5450 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); |
5355 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); | 5451 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); |
5356 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); | 5452 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); |
@@ -5417,6 +5513,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5417 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); | 5513 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); |
5418 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); | 5514 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); |
5419 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); | 5515 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); |
5516 | AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags); | ||
5420 | 5517 | ||
5421 | AddGenericPacketHandler("autopilot", HandleAutopilot); | 5518 | AddGenericPacketHandler("autopilot", HandleAutopilot); |
5422 | } | 5519 | } |
@@ -5452,6 +5549,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5452 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || | 5549 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || |
5453 | (x.CameraUpAxis != lastarg.CameraUpAxis) || | 5550 | (x.CameraUpAxis != lastarg.CameraUpAxis) || |
5454 | (x.ControlFlags != lastarg.ControlFlags) || | 5551 | (x.ControlFlags != lastarg.ControlFlags) || |
5552 | (x.ControlFlags != 0) || | ||
5455 | (x.Far != lastarg.Far) || | 5553 | (x.Far != lastarg.Far) || |
5456 | (x.Flags != lastarg.Flags) || | 5554 | (x.Flags != lastarg.Flags) || |
5457 | (x.State != lastarg.State) || | 5555 | (x.State != lastarg.State) || |
@@ -6350,6 +6448,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6350 | { | 6448 | { |
6351 | handlerCompleteMovementToRegion(sender, true); | 6449 | handlerCompleteMovementToRegion(sender, true); |
6352 | } | 6450 | } |
6451 | else | ||
6452 | m_log.Debug("HandleCompleteAgentMovement NULL handler"); | ||
6453 | |||
6353 | handlerCompleteMovementToRegion = null; | 6454 | handlerCompleteMovementToRegion = null; |
6354 | 6455 | ||
6355 | return true; | 6456 | return true; |
@@ -6367,7 +6468,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6367 | return true; | 6468 | return true; |
6368 | } | 6469 | } |
6369 | #endregion | 6470 | #endregion |
6370 | 6471 | /* | |
6371 | StartAnim handlerStartAnim = null; | 6472 | StartAnim handlerStartAnim = null; |
6372 | StopAnim handlerStopAnim = null; | 6473 | StopAnim handlerStopAnim = null; |
6373 | 6474 | ||
@@ -6391,6 +6492,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6391 | } | 6492 | } |
6392 | } | 6493 | } |
6393 | return true; | 6494 | return true; |
6495 | */ | ||
6496 | ChangeAnim handlerChangeAnim = null; | ||
6497 | |||
6498 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | ||
6499 | { | ||
6500 | handlerChangeAnim = OnChangeAnim; | ||
6501 | if (handlerChangeAnim != null) | ||
6502 | { | ||
6503 | handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false); | ||
6504 | } | ||
6505 | } | ||
6506 | |||
6507 | handlerChangeAnim = OnChangeAnim; | ||
6508 | if (handlerChangeAnim != null) | ||
6509 | { | ||
6510 | handlerChangeAnim(UUID.Zero, false, true); | ||
6511 | } | ||
6512 | |||
6513 | return true; | ||
6394 | } | 6514 | } |
6395 | 6515 | ||
6396 | private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) | 6516 | private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) |
@@ -7016,10 +7136,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7016 | // 46,47,48 are special positions within the packet | 7136 | // 46,47,48 are special positions within the packet |
7017 | // This may change so perhaps we need a better way | 7137 | // This may change so perhaps we need a better way |
7018 | // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) | 7138 | // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) |
7019 | bool UsePhysics = (data[46] != 0) ? true : false; | 7139 | /* |
7020 | bool IsTemporary = (data[47] != 0) ? true : false; | 7140 | bool UsePhysics = (data[46] != 0) ? true : false; |
7021 | bool IsPhantom = (data[48] != 0) ? true : false; | 7141 | bool IsTemporary = (data[47] != 0) ? true : false; |
7022 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); | 7142 | bool IsPhantom = (data[48] != 0) ? true : false; |
7143 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); | ||
7144 | */ | ||
7145 | bool UsePhysics = flags.AgentData.UsePhysics; | ||
7146 | bool IsPhantom = flags.AgentData.IsPhantom; | ||
7147 | bool IsTemporary = flags.AgentData.IsTemporary; | ||
7148 | ObjectFlagUpdatePacket.ExtraPhysicsBlock[] blocks = flags.ExtraPhysics; | ||
7149 | ExtraPhysicsData physdata = new ExtraPhysicsData(); | ||
7150 | |||
7151 | if (blocks == null || blocks.Length == 0) | ||
7152 | { | ||
7153 | physdata.PhysShapeType = PhysShapeType.invalid; | ||
7154 | } | ||
7155 | else | ||
7156 | { | ||
7157 | ObjectFlagUpdatePacket.ExtraPhysicsBlock phsblock = blocks[0]; | ||
7158 | physdata.PhysShapeType = (PhysShapeType)phsblock.PhysicsShapeType; | ||
7159 | physdata.Bounce = phsblock.Restitution; | ||
7160 | physdata.Density = phsblock.Density; | ||
7161 | physdata.Friction = phsblock.Friction; | ||
7162 | physdata.GravitationModifier = phsblock.GravityMultiplier; | ||
7163 | } | ||
7164 | |||
7165 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); | ||
7023 | } | 7166 | } |
7024 | return true; | 7167 | return true; |
7025 | } | 7168 | } |
@@ -8620,16 +8763,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8620 | 8763 | ||
8621 | #region Parcel related packets | 8764 | #region Parcel related packets |
8622 | 8765 | ||
8766 | // acumulate several HandleRegionHandleRequest consecutive overlaping requests | ||
8767 | // to be done with minimal resources as possible | ||
8768 | // variables temporary here while in test | ||
8769 | |||
8770 | Queue<UUID> RegionHandleRequests = new Queue<UUID>(); | ||
8771 | bool RegionHandleRequestsInService = false; | ||
8772 | |||
8623 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) | 8773 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) |
8624 | { | 8774 | { |
8625 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | 8775 | UUID currentUUID; |
8626 | 8776 | ||
8627 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; | 8777 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; |
8628 | if (handlerRegionHandleRequest != null) | 8778 | |
8779 | if (handlerRegionHandleRequest == null) | ||
8780 | return true; | ||
8781 | |||
8782 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | ||
8783 | |||
8784 | lock (RegionHandleRequests) | ||
8629 | { | 8785 | { |
8630 | handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); | 8786 | if (RegionHandleRequestsInService) |
8787 | { | ||
8788 | // we are already busy doing a previus request | ||
8789 | // so enqueue it | ||
8790 | RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID); | ||
8791 | return true; | ||
8792 | } | ||
8793 | |||
8794 | // else do it | ||
8795 | currentUUID = rhrPack.RequestBlock.RegionID; | ||
8796 | RegionHandleRequestsInService = true; | ||
8631 | } | 8797 | } |
8632 | return true; | 8798 | |
8799 | while (true) | ||
8800 | { | ||
8801 | handlerRegionHandleRequest(this, currentUUID); | ||
8802 | |||
8803 | lock (RegionHandleRequests) | ||
8804 | { | ||
8805 | // exit condition, nothing to do or closed | ||
8806 | // current code seems to assume we may loose the handler at anytime, | ||
8807 | // so keep checking it | ||
8808 | handlerRegionHandleRequest = OnRegionHandleRequest; | ||
8809 | |||
8810 | if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null) | ||
8811 | { | ||
8812 | RegionHandleRequests.Clear(); | ||
8813 | RegionHandleRequestsInService = false; | ||
8814 | return true; | ||
8815 | } | ||
8816 | currentUUID = RegionHandleRequests.Dequeue(); | ||
8817 | } | ||
8818 | } | ||
8819 | |||
8820 | return true; // actually unreached | ||
8633 | } | 8821 | } |
8634 | 8822 | ||
8635 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) | 8823 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) |
@@ -9885,7 +10073,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9885 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, | 10073 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, |
9886 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), | 10074 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), |
9887 | UpdateMuteListEntry.MuteData.MuteType, | 10075 | UpdateMuteListEntry.MuteData.MuteType, |
9888 | UpdateMuteListEntry.AgentData.AgentID); | 10076 | UpdateMuteListEntry.MuteData.MuteFlags); |
9889 | return true; | 10077 | return true; |
9890 | } | 10078 | } |
9891 | return false; | 10079 | return false; |
@@ -9900,8 +10088,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9900 | { | 10088 | { |
9901 | handlerRemoveMuteListEntry(this, | 10089 | handlerRemoveMuteListEntry(this, |
9902 | RemoveMuteListEntry.MuteData.MuteID, | 10090 | RemoveMuteListEntry.MuteData.MuteID, |
9903 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), | 10091 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName)); |
9904 | RemoveMuteListEntry.AgentData.AgentID); | ||
9905 | return true; | 10092 | return true; |
9906 | } | 10093 | } |
9907 | return false; | 10094 | return false; |
@@ -9945,10 +10132,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9945 | return false; | 10132 | return false; |
9946 | } | 10133 | } |
9947 | 10134 | ||
10135 | private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet) | ||
10136 | { | ||
10137 | ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags = | ||
10138 | (ChangeInventoryItemFlagsPacket)packet; | ||
10139 | ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags; | ||
10140 | if (handlerChangeInventoryItemFlags != null) | ||
10141 | { | ||
10142 | foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData) | ||
10143 | handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags); | ||
10144 | return true; | ||
10145 | } | ||
10146 | return false; | ||
10147 | } | ||
10148 | |||
9948 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) | 10149 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) |
9949 | { | 10150 | { |
9950 | return true; | 10151 | return true; |
9951 | } | 10152 | } |
10153 | |||
10154 | private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack) | ||
10155 | { | ||
10156 | CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack; | ||
10157 | |||
10158 | #region Packet Session and User Check | ||
10159 | if (m_checkPackets) | ||
10160 | { | ||
10161 | if (packet.AgentData.SessionID != SessionId || | ||
10162 | packet.AgentData.AgentID != AgentId) | ||
10163 | return true; | ||
10164 | } | ||
10165 | #endregion | ||
10166 | MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null; | ||
10167 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
10168 | foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData) | ||
10169 | { | ||
10170 | InventoryItemBase b = new InventoryItemBase(); | ||
10171 | b.ID = n.OldItemID; | ||
10172 | b.Folder = n.OldFolderID; | ||
10173 | items.Add(b); | ||
10174 | } | ||
10175 | |||
10176 | handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy; | ||
10177 | if (handlerMoveItemsAndLeaveCopy != null) | ||
10178 | { | ||
10179 | handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID); | ||
10180 | } | ||
10181 | |||
10182 | return true; | ||
10183 | } | ||
9952 | 10184 | ||
9953 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) | 10185 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) |
9954 | { | 10186 | { |
@@ -10375,6 +10607,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10375 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; | 10607 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; |
10376 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; | 10608 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; |
10377 | 10609 | ||
10610 | Scene scene = (Scene)m_scene; | ||
10611 | if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID))) | ||
10612 | { | ||
10613 | ScenePresence p; | ||
10614 | if (scene.TryGetScenePresence(sender.AgentId, out p)) | ||
10615 | { | ||
10616 | if (p.GodLevel >= 200) | ||
10617 | { | ||
10618 | groupProfileReply.GroupData.OpenEnrollment = true; | ||
10619 | groupProfileReply.GroupData.MembershipFee = 0; | ||
10620 | } | ||
10621 | } | ||
10622 | } | ||
10623 | |||
10378 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); | 10624 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); |
10379 | } | 10625 | } |
10380 | return true; | 10626 | return true; |
@@ -10948,11 +11194,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10948 | 11194 | ||
10949 | StartLure handlerStartLure = OnStartLure; | 11195 | StartLure handlerStartLure = OnStartLure; |
10950 | if (handlerStartLure != null) | 11196 | if (handlerStartLure != null) |
10951 | handlerStartLure(startLureRequest.Info.LureType, | 11197 | { |
10952 | Utils.BytesToString( | 11198 | for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++) |
10953 | startLureRequest.Info.Message), | 11199 | { |
10954 | startLureRequest.TargetData[0].TargetID, | 11200 | handlerStartLure(startLureRequest.Info.LureType, |
10955 | this); | 11201 | Utils.BytesToString( |
11202 | startLureRequest.Info.Message), | ||
11203 | startLureRequest.TargetData[i].TargetID, | ||
11204 | this); | ||
11205 | } | ||
11206 | } | ||
10956 | return true; | 11207 | return true; |
10957 | } | 11208 | } |
10958 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) | 11209 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) |
@@ -11066,10 +11317,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11066 | } | 11317 | } |
11067 | #endregion | 11318 | #endregion |
11068 | 11319 | ||
11069 | ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; | 11320 | ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; |
11070 | if (handlerClassifiedGodDelete != null) | 11321 | if (handlerClassifiedGodDelete != null) |
11071 | handlerClassifiedGodDelete( | 11322 | handlerClassifiedGodDelete( |
11072 | classifiedGodDelete.Data.ClassifiedID, | 11323 | classifiedGodDelete.Data.ClassifiedID, |
11324 | classifiedGodDelete.Data.QueryID, | ||
11073 | this); | 11325 | this); |
11074 | return true; | 11326 | return true; |
11075 | } | 11327 | } |
@@ -11435,209 +11687,147 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11435 | } | 11687 | } |
11436 | else | 11688 | else |
11437 | { | 11689 | { |
11438 | // m_log.DebugFormat( | 11690 | ClientChangeObject updatehandler = onClientChangeObject; |
11439 | // "[CLIENT]: Processing block {0} type {1} for {2} {3}", | ||
11440 | // i, block.Type, part.Name, part.LocalId); | ||
11441 | 11691 | ||
11442 | // // Do this once since fetch parts creates a new array. | 11692 | if (updatehandler != null) |
11443 | // SceneObjectPart[] parts = part.ParentGroup.Parts; | 11693 | { |
11444 | // for (int j = 0; j < parts.Length; j++) | 11694 | ObjectChangeData udata = new ObjectChangeData(); |
11445 | // { | ||
11446 | // part.StoreUndoState(); | ||
11447 | // parts[j].IgnoreUndoUpdate = true; | ||
11448 | // } | ||
11449 | 11695 | ||
11450 | UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; | 11696 | /*ubit from ll JIRA: |
11697 | * 0x01 position | ||
11698 | * 0x02 rotation | ||
11699 | * 0x04 scale | ||
11700 | |||
11701 | * 0x08 LINK_SET | ||
11702 | * 0x10 UNIFORM for scale | ||
11703 | */ | ||
11451 | 11704 | ||
11452 | switch (block.Type) | 11705 | // translate to internal changes |
11453 | { | 11706 | // not all cases .. just the ones older code did |
11454 | case 1: | ||
11455 | Vector3 pos1 = new Vector3(block.Data, 0); | ||
11456 | 11707 | ||
11457 | UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11708 | switch (block.Type) |
11458 | if (handlerUpdatePrimSinglePosition != null) | 11709 | { |
11459 | { | 11710 | case 1: //change position sp |
11460 | // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 11711 | udata.position = new Vector3(block.Data, 0); |
11461 | handlerUpdatePrimSinglePosition(localId, pos1, this); | ||
11462 | } | ||
11463 | break; | ||
11464 | 11712 | ||
11465 | case 2: | 11713 | udata.change = ObjectChangeType.primP; |
11466 | Quaternion rot1 = new Quaternion(block.Data, 0, true); | 11714 | updatehandler(localId, udata, this); |
11715 | break; | ||
11467 | 11716 | ||
11468 | UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; | 11717 | case 2: // rotation sp |
11469 | if (handlerUpdatePrimSingleRotation != null) | 11718 | udata.rotation = new Quaternion(block.Data, 0, true); |
11470 | { | ||
11471 | // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W); | ||
11472 | handlerUpdatePrimSingleRotation(localId, rot1, this); | ||
11473 | } | ||
11474 | break; | ||
11475 | 11719 | ||
11476 | case 3: | 11720 | udata.change = ObjectChangeType.primR; |
11477 | Vector3 rotPos = new Vector3(block.Data, 0); | 11721 | updatehandler(localId, udata, this); |
11478 | Quaternion rot2 = new Quaternion(block.Data, 12, true); | 11722 | break; |
11479 | 11723 | ||
11480 | UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; | 11724 | case 3: // position plus rotation |
11481 | if (handlerUpdatePrimSingleRotationPosition != null) | 11725 | udata.position = new Vector3(block.Data, 0); |
11482 | { | 11726 | udata.rotation = new Quaternion(block.Data, 12, true); |
11483 | // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z); | ||
11484 | // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W); | ||
11485 | handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this); | ||
11486 | } | ||
11487 | break; | ||
11488 | 11727 | ||
11489 | case 4: | 11728 | udata.change = ObjectChangeType.primPR; |
11490 | case 20: | 11729 | updatehandler(localId, udata, this); |
11491 | Vector3 scale4 = new Vector3(block.Data, 0); | 11730 | break; |
11492 | 11731 | ||
11493 | UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; | 11732 | case 4: // scale sp |
11494 | if (handlerUpdatePrimScale != null) | 11733 | udata.scale = new Vector3(block.Data, 0); |
11495 | { | 11734 | udata.change = ObjectChangeType.primS; |
11496 | // m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z); | ||
11497 | handlerUpdatePrimScale(localId, scale4, this); | ||
11498 | } | ||
11499 | break; | ||
11500 | 11735 | ||
11501 | case 5: | 11736 | updatehandler(localId, udata, this); |
11502 | Vector3 scale1 = new Vector3(block.Data, 12); | 11737 | break; |
11503 | Vector3 pos11 = new Vector3(block.Data, 0); | ||
11504 | 11738 | ||
11505 | handlerUpdatePrimScale = OnUpdatePrimScale; | 11739 | case 0x14: // uniform scale sp |
11506 | if (handlerUpdatePrimScale != null) | 11740 | udata.scale = new Vector3(block.Data, 0); |
11507 | { | ||
11508 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11509 | handlerUpdatePrimScale(localId, scale1, this); | ||
11510 | 11741 | ||
11511 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11742 | udata.change = ObjectChangeType.primUS; |
11512 | if (handlerUpdatePrimSinglePosition != null) | 11743 | updatehandler(localId, udata, this); |
11513 | { | 11744 | break; |
11514 | handlerUpdatePrimSinglePosition(localId, pos11, this); | ||
11515 | } | ||
11516 | } | ||
11517 | break; | ||
11518 | 11745 | ||
11519 | case 9: | 11746 | case 5: // scale and position sp |
11520 | Vector3 pos2 = new Vector3(block.Data, 0); | 11747 | udata.position = new Vector3(block.Data, 0); |
11748 | udata.scale = new Vector3(block.Data, 12); | ||
11521 | 11749 | ||
11522 | UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; | 11750 | udata.change = ObjectChangeType.primPS; |
11751 | updatehandler(localId, udata, this); | ||
11752 | break; | ||
11523 | 11753 | ||
11524 | if (handlerUpdateVector != null) | 11754 | case 0x15: //uniform scale and position |
11525 | { | 11755 | udata.position = new Vector3(block.Data, 0); |
11526 | handlerUpdateVector(localId, pos2, this); | 11756 | udata.scale = new Vector3(block.Data, 12); |
11527 | } | ||
11528 | break; | ||
11529 | 11757 | ||
11530 | case 10: | 11758 | udata.change = ObjectChangeType.primPUS; |
11531 | Quaternion rot3 = new Quaternion(block.Data, 0, true); | 11759 | updatehandler(localId, udata, this); |
11760 | break; | ||
11532 | 11761 | ||
11533 | UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; | 11762 | // now group related (bit 4) |
11534 | if (handlerUpdatePrimRotation != null) | 11763 | case 9: //( 8 + 1 )group position |
11535 | { | 11764 | udata.position = new Vector3(block.Data, 0); |
11536 | // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W); | ||
11537 | handlerUpdatePrimRotation(localId, rot3, this); | ||
11538 | } | ||
11539 | break; | ||
11540 | 11765 | ||
11541 | case 11: | 11766 | udata.change = ObjectChangeType.groupP; |
11542 | Vector3 pos3 = new Vector3(block.Data, 0); | 11767 | updatehandler(localId, udata, this); |
11543 | Quaternion rot4 = new Quaternion(block.Data, 12, true); | 11768 | break; |
11544 | 11769 | ||
11545 | handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; | 11770 | case 0x0A: // (8 + 2) group rotation |
11546 | if (handlerUpdatePrimGroupRotation != null) | 11771 | udata.rotation = new Quaternion(block.Data, 0, true); |
11547 | { | ||
11548 | // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
11549 | // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W); | ||
11550 | handlerUpdatePrimGroupRotation(localId, pos3, rot4, this); | ||
11551 | } | ||
11552 | break; | ||
11553 | case 12: | ||
11554 | case 28: | ||
11555 | Vector3 scale7 = new Vector3(block.Data, 0); | ||
11556 | 11772 | ||
11557 | UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | 11773 | udata.change = ObjectChangeType.groupR; |
11558 | if (handlerUpdatePrimGroupScale != null) | 11774 | updatehandler(localId, udata, this); |
11559 | { | 11775 | break; |
11560 | // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); | ||
11561 | handlerUpdatePrimGroupScale(localId, scale7, this); | ||
11562 | } | ||
11563 | break; | ||
11564 | 11776 | ||
11565 | case 13: | 11777 | case 0x0B: //( 8 + 2 + 1) group rotation and position |
11566 | Vector3 scale2 = new Vector3(block.Data, 12); | 11778 | udata.position = new Vector3(block.Data, 0); |
11567 | Vector3 pos4 = new Vector3(block.Data, 0); | 11779 | udata.rotation = new Quaternion(block.Data, 12, true); |
11568 | 11780 | ||
11569 | handlerUpdatePrimScale = OnUpdatePrimScale; | 11781 | udata.change = ObjectChangeType.groupPR; |
11570 | if (handlerUpdatePrimScale != null) | 11782 | updatehandler(localId, udata, this); |
11571 | { | 11783 | break; |
11572 | //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11573 | handlerUpdatePrimScale(localId, scale2, this); | ||
11574 | 11784 | ||
11575 | // Change the position based on scale (for bug number 246) | 11785 | case 0x0C: // (8 + 4) group scale |
11576 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11786 | // only afects root prim and only sent by viewer editor object tab scaling |
11577 | // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 11787 | // mouse edition only allows uniform scaling |
11578 | if (handlerUpdatePrimSinglePosition != null) | 11788 | // SL MAY CHANGE THIS in viewers |
11579 | { | ||
11580 | handlerUpdatePrimSinglePosition(localId, pos4, this); | ||
11581 | } | ||
11582 | } | ||
11583 | break; | ||
11584 | 11789 | ||
11585 | case 29: | 11790 | udata.scale = new Vector3(block.Data, 0); |
11586 | Vector3 scale5 = new Vector3(block.Data, 12); | ||
11587 | Vector3 pos5 = new Vector3(block.Data, 0); | ||
11588 | 11791 | ||
11589 | handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | 11792 | udata.change = ObjectChangeType.groupS; |
11590 | if (handlerUpdatePrimGroupScale != null) | 11793 | updatehandler(localId, udata, this); |
11591 | { | ||
11592 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11593 | part.StoreUndoState(true); | ||
11594 | part.IgnoreUndoUpdate = true; | ||
11595 | handlerUpdatePrimGroupScale(localId, scale5, this); | ||
11596 | handlerUpdateVector = OnUpdatePrimGroupPosition; | ||
11597 | 11794 | ||
11598 | if (handlerUpdateVector != null) | 11795 | break; |
11599 | { | ||
11600 | handlerUpdateVector(localId, pos5, this); | ||
11601 | } | ||
11602 | 11796 | ||
11603 | part.IgnoreUndoUpdate = false; | 11797 | case 0x0D: //(8 + 4 + 1) group scale and position |
11604 | } | 11798 | // exception as above |
11605 | 11799 | ||
11606 | break; | 11800 | udata.position = new Vector3(block.Data, 0); |
11801 | udata.scale = new Vector3(block.Data, 12); | ||
11607 | 11802 | ||
11608 | case 21: | 11803 | udata.change = ObjectChangeType.groupPS; |
11609 | Vector3 scale6 = new Vector3(block.Data, 12); | 11804 | updatehandler(localId, udata, this); |
11610 | Vector3 pos6 = new Vector3(block.Data, 0); | 11805 | break; |
11611 | 11806 | ||
11612 | handlerUpdatePrimScale = OnUpdatePrimScale; | 11807 | case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM |
11613 | if (handlerUpdatePrimScale != null) | 11808 | udata.scale = new Vector3(block.Data, 0); |
11614 | { | ||
11615 | part.StoreUndoState(false); | ||
11616 | part.IgnoreUndoUpdate = true; | ||
11617 | 11809 | ||
11618 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | 11810 | udata.change = ObjectChangeType.groupUS; |
11619 | handlerUpdatePrimScale(localId, scale6, this); | 11811 | updatehandler(localId, udata, this); |
11620 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11812 | break; |
11621 | if (handlerUpdatePrimSinglePosition != null) | ||
11622 | { | ||
11623 | handlerUpdatePrimSinglePosition(localId, pos6, this); | ||
11624 | } | ||
11625 | 11813 | ||
11626 | part.IgnoreUndoUpdate = false; | 11814 | case 0x1D: // (UNIFORM + GROUP + SCALE + POS) |
11627 | } | 11815 | udata.position = new Vector3(block.Data, 0); |
11628 | break; | 11816 | udata.scale = new Vector3(block.Data, 12); |
11629 | 11817 | ||
11630 | default: | 11818 | udata.change = ObjectChangeType.groupPUS; |
11631 | m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); | 11819 | updatehandler(localId, udata, this); |
11632 | break; | 11820 | break; |
11821 | |||
11822 | default: | ||
11823 | m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); | ||
11824 | break; | ||
11825 | } | ||
11633 | } | 11826 | } |
11634 | 11827 | ||
11635 | // for (int j = 0; j < parts.Length; j++) | ||
11636 | // parts[j].IgnoreUndoUpdate = false; | ||
11637 | } | 11828 | } |
11638 | } | 11829 | } |
11639 | } | 11830 | } |
11640 | |||
11641 | return true; | 11831 | return true; |
11642 | } | 11832 | } |
11643 | 11833 | ||
@@ -12087,7 +12277,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12087 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", | 12277 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", |
12088 | // requestID, taskID, (SourceType)sourceType, Name); | 12278 | // requestID, taskID, (SourceType)sourceType, Name); |
12089 | 12279 | ||
12280 | |||
12281 | //Note, the bool returned from the below function is useless since it is always false. | ||
12090 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); | 12282 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); |
12283 | |||
12091 | } | 12284 | } |
12092 | 12285 | ||
12093 | /// <summary> | 12286 | /// <summary> |
@@ -12153,7 +12346,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12153 | /// <returns></returns> | 12346 | /// <returns></returns> |
12154 | private static int CalculateNumPackets(byte[] data) | 12347 | private static int CalculateNumPackets(byte[] data) |
12155 | { | 12348 | { |
12156 | const uint m_maxPacketSize = 600; | 12349 | // const uint m_maxPacketSize = 600; |
12350 | uint m_maxPacketSize = MaxTransferBytesPerPacket; | ||
12157 | int numPackets = 1; | 12351 | int numPackets = 1; |
12158 | 12352 | ||
12159 | if (data == null) | 12353 | if (data == null) |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 8963756..c472176 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -158,6 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
158 | 158 | ||
159 | private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC | 159 | private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC |
160 | private int m_maxRTO = 60000; | 160 | private int m_maxRTO = 60000; |
161 | public bool m_deliverPackets = true; | ||
161 | 162 | ||
162 | /// <summary> | 163 | /// <summary> |
163 | /// Default constructor | 164 | /// Default constructor |
@@ -440,6 +441,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
440 | if (category >= 0 && category < m_packetOutboxes.Length) | 441 | if (category >= 0 && category < m_packetOutboxes.Length) |
441 | { | 442 | { |
442 | OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; | 443 | OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; |
444 | |||
445 | if (m_deliverPackets == false) | ||
446 | { | ||
447 | queue.Enqueue(packet); | ||
448 | return true; | ||
449 | } | ||
450 | |||
443 | TokenBucket bucket = m_throttleCategories[category]; | 451 | TokenBucket bucket = m_throttleCategories[category]; |
444 | 452 | ||
445 | // Don't send this packet if there is already a packet waiting in the queue | 453 | // Don't send this packet if there is already a packet waiting in the queue |
@@ -489,7 +497,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
489 | /// <returns>True if any packets were sent, otherwise false</returns> | 497 | /// <returns>True if any packets were sent, otherwise false</returns> |
490 | public bool DequeueOutgoing() | 498 | public bool DequeueOutgoing() |
491 | { | 499 | { |
492 | OutgoingPacket packet; | 500 | if (m_deliverPackets == false) return false; |
501 | |||
502 | OutgoingPacket packet = null; | ||
493 | OpenSim.Framework.LocklessQueue<OutgoingPacket> queue; | 503 | OpenSim.Framework.LocklessQueue<OutgoingPacket> queue; |
494 | TokenBucket bucket; | 504 | TokenBucket bucket; |
495 | bool packetSent = false; | 505 | bool packetSent = false; |
@@ -521,32 +531,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
521 | // No dequeued packet waiting to be sent, try to pull one off | 531 | // No dequeued packet waiting to be sent, try to pull one off |
522 | // this queue | 532 | // this queue |
523 | queue = m_packetOutboxes[i]; | 533 | queue = m_packetOutboxes[i]; |
524 | if (queue.Dequeue(out packet)) | 534 | if (queue != null) |
525 | { | 535 | { |
526 | // A packet was pulled off the queue. See if we have | 536 | bool success = false; |
527 | // enough tokens in the bucket to send it out | 537 | try |
528 | if (bucket.RemoveTokens(packet.Buffer.DataLength)) | ||
529 | { | 538 | { |
530 | // Send the packet | 539 | success = queue.Dequeue(out packet); |
531 | m_udpServer.SendPacketFinal(packet); | ||
532 | packetSent = true; | ||
533 | } | 540 | } |
534 | else | 541 | catch |
535 | { | 542 | { |
536 | // Save the dequeued packet for the next iteration | 543 | m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); |
537 | m_nextPackets[i] = packet; | ||
538 | } | 544 | } |
539 | 545 | if (success) | |
540 | // If the queue is empty after this dequeue, fire the queue | 546 | { |
541 | // empty callback now so it has a chance to fill before we | 547 | // A packet was pulled off the queue. See if we have |
542 | // get back here | 548 | // enough tokens in the bucket to send it out |
543 | if (queue.Count == 0) | 549 | if (bucket.RemoveTokens(packet.Buffer.DataLength)) |
550 | { | ||
551 | // Send the packet | ||
552 | m_udpServer.SendPacketFinal(packet); | ||
553 | packetSent = true; | ||
554 | } | ||
555 | else | ||
556 | { | ||
557 | // Save the dequeued packet for the next iteration | ||
558 | m_nextPackets[i] = packet; | ||
559 | } | ||
560 | |||
561 | // If the queue is empty after this dequeue, fire the queue | ||
562 | // empty callback now so it has a chance to fill before we | ||
563 | // get back here | ||
564 | if (queue.Count == 0) | ||
565 | emptyCategories |= CategoryToFlag(i); | ||
566 | } | ||
567 | else | ||
568 | { | ||
569 | // No packets in this queue. Fire the queue empty callback | ||
570 | // if it has not been called recently | ||
544 | emptyCategories |= CategoryToFlag(i); | 571 | emptyCategories |= CategoryToFlag(i); |
572 | } | ||
545 | } | 573 | } |
546 | else | 574 | else |
547 | { | 575 | { |
548 | // No packets in this queue. Fire the queue empty callback | 576 | m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); |
549 | // if it has not been called recently | ||
550 | emptyCategories |= CategoryToFlag(i); | 577 | emptyCategories |= CategoryToFlag(i); |
551 | } | 578 | } |
552 | } | 579 | } |
@@ -704,4 +731,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
704 | } | 731 | } |
705 | } | 732 | } |
706 | } | 733 | } |
707 | } \ No newline at end of file | 734 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 42247ca..7820caf 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -113,7 +113,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
113 | /// <summary>Handlers for incoming packets</summary> | 113 | /// <summary>Handlers for incoming packets</summary> |
114 | //PacketEventDictionary packetEvents = new PacketEventDictionary(); | 114 | //PacketEventDictionary packetEvents = new PacketEventDictionary(); |
115 | /// <summary>Incoming packets that are awaiting handling</summary> | 115 | /// <summary>Incoming packets that are awaiting handling</summary> |
116 | private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); | 116 | //private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); |
117 | |||
118 | private DoubleQueue<IncomingPacket> packetInbox = new DoubleQueue<IncomingPacket>(); | ||
117 | 119 | ||
118 | /// <summary></summary> | 120 | /// <summary></summary> |
119 | //private UDPClientCollection m_clients = new UDPClientCollection(); | 121 | //private UDPClientCollection m_clients = new UDPClientCollection(); |
@@ -168,6 +170,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
168 | /// <summary>Flag to signal when clients should send pings</summary> | 170 | /// <summary>Flag to signal when clients should send pings</summary> |
169 | protected bool m_sendPing; | 171 | protected bool m_sendPing; |
170 | 172 | ||
173 | private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); | ||
174 | |||
171 | private int m_defaultRTO = 0; | 175 | private int m_defaultRTO = 0; |
172 | private int m_maxRTO = 0; | 176 | private int m_maxRTO = 0; |
173 | private int m_ackTimeout = 0; | 177 | private int m_ackTimeout = 0; |
@@ -887,21 +891,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
887 | 891 | ||
888 | #region Packet to Client Mapping | 892 | #region Packet to Client Mapping |
889 | 893 | ||
890 | // UseCircuitCode handling | 894 | // If there is already a client for this endpoint, don't process UseCircuitCode |
891 | if (packet.Type == PacketType.UseCircuitCode) | 895 | IClientAPI client = null; |
896 | if (!m_scene.TryGetClient(endPoint, out client) || !(client is LLClientView)) | ||
892 | { | 897 | { |
893 | // We need to copy the endpoint so that it doesn't get changed when another thread reuses the | 898 | // UseCircuitCode handling |
894 | // buffer. | 899 | if (packet.Type == PacketType.UseCircuitCode) |
895 | object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet }; | 900 | { |
901 | // And if there is a UseCircuitCode pending, also drop it | ||
902 | lock (m_pendingCache) | ||
903 | { | ||
904 | if (m_pendingCache.Contains(endPoint)) | ||
905 | return; | ||
896 | 906 | ||
897 | Util.FireAndForget(HandleUseCircuitCode, array); | 907 | m_pendingCache.AddOrUpdate(endPoint, new Queue<UDPPacketBuffer>(), 60); |
908 | } | ||
898 | 909 | ||
899 | return; | 910 | // We need to copy the endpoint so that it doesn't get changed when another thread reuses the |
911 | // buffer. | ||
912 | object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet }; | ||
913 | |||
914 | Util.FireAndForget(HandleUseCircuitCode, array); | ||
915 | |||
916 | return; | ||
917 | } | ||
918 | } | ||
919 | |||
920 | // If this is a pending connection, enqueue, don't process yet | ||
921 | lock (m_pendingCache) | ||
922 | { | ||
923 | Queue<UDPPacketBuffer> queue; | ||
924 | if (m_pendingCache.TryGetValue(endPoint, out queue)) | ||
925 | { | ||
926 | //m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); | ||
927 | queue.Enqueue(buffer); | ||
928 | return; | ||
929 | } | ||
900 | } | 930 | } |
901 | 931 | ||
902 | // Determine which agent this packet came from | 932 | // Determine which agent this packet came from |
903 | IClientAPI client; | 933 | if (client == null || !(client is LLClientView)) |
904 | if (!m_scene.TryGetClient(endPoint, out client) || !(client is LLClientView)) | ||
905 | { | 934 | { |
906 | //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); | 935 | //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); |
907 | return; | 936 | return; |
@@ -910,7 +939,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
910 | udpClient = ((LLClientView)client).UDPClient; | 939 | udpClient = ((LLClientView)client).UDPClient; |
911 | 940 | ||
912 | if (!udpClient.IsConnected) | 941 | if (!udpClient.IsConnected) |
942 | { | ||
943 | // m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); | ||
913 | return; | 944 | return; |
945 | } | ||
914 | 946 | ||
915 | #endregion Packet to Client Mapping | 947 | #endregion Packet to Client Mapping |
916 | 948 | ||
@@ -1013,7 +1045,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1013 | #endregion Ping Check Handling | 1045 | #endregion Ping Check Handling |
1014 | 1046 | ||
1015 | // Inbox insertion | 1047 | // Inbox insertion |
1016 | packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); | 1048 | if (packet.Type == PacketType.AgentUpdate || |
1049 | packet.Type == PacketType.ChatFromViewer) | ||
1050 | packetInbox.EnqueueHigh(new IncomingPacket((LLClientView)client, packet)); | ||
1051 | else | ||
1052 | packetInbox.EnqueueLow(new IncomingPacket((LLClientView)client, packet)); | ||
1053 | // packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); | ||
1017 | } | 1054 | } |
1018 | 1055 | ||
1019 | #region BinaryStats | 1056 | #region BinaryStats |
@@ -1133,6 +1170,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1133 | // We only want to send initial data to new clients, not ones which are being converted from child to root. | 1170 | // We only want to send initial data to new clients, not ones which are being converted from child to root. |
1134 | if (client != null) | 1171 | if (client != null) |
1135 | client.SceneAgent.SendInitialDataToMe(); | 1172 | client.SceneAgent.SendInitialDataToMe(); |
1173 | |||
1174 | // Now we know we can handle more data | ||
1175 | Thread.Sleep(200); | ||
1176 | |||
1177 | // Obtain the queue and remove it from the cache | ||
1178 | Queue<UDPPacketBuffer> queue = null; | ||
1179 | |||
1180 | lock (m_pendingCache) | ||
1181 | { | ||
1182 | if (!m_pendingCache.TryGetValue(endPoint, out queue)) | ||
1183 | { | ||
1184 | m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present"); | ||
1185 | return; | ||
1186 | } | ||
1187 | m_pendingCache.Remove(endPoint); | ||
1188 | } | ||
1189 | |||
1190 | m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); | ||
1191 | |||
1192 | // Reinject queued packets | ||
1193 | while(queue.Count > 0) | ||
1194 | { | ||
1195 | UDPPacketBuffer buf = queue.Dequeue(); | ||
1196 | PacketReceived(buf); | ||
1197 | } | ||
1198 | queue = null; | ||
1136 | } | 1199 | } |
1137 | else | 1200 | else |
1138 | { | 1201 | { |
@@ -1140,6 +1203,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1140 | m_log.WarnFormat( | 1203 | m_log.WarnFormat( |
1141 | "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", | 1204 | "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", |
1142 | uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); | 1205 | uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); |
1206 | lock (m_pendingCache) | ||
1207 | m_pendingCache.Remove(endPoint); | ||
1143 | } | 1208 | } |
1144 | 1209 | ||
1145 | // m_log.DebugFormat( | 1210 | // m_log.DebugFormat( |
@@ -1258,7 +1323,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1258 | if (!client.SceneAgent.IsChildAgent) | 1323 | if (!client.SceneAgent.IsChildAgent) |
1259 | client.Kick("Simulator logged you out due to connection timeout"); | 1324 | client.Kick("Simulator logged you out due to connection timeout"); |
1260 | 1325 | ||
1261 | client.CloseWithoutChecks(); | 1326 | client.CloseWithoutChecks(true); |
1262 | } | 1327 | } |
1263 | } | 1328 | } |
1264 | 1329 | ||
@@ -1270,6 +1335,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1270 | 1335 | ||
1271 | while (base.IsRunningInbound) | 1336 | while (base.IsRunningInbound) |
1272 | { | 1337 | { |
1338 | m_scene.ThreadAlive(1); | ||
1273 | try | 1339 | try |
1274 | { | 1340 | { |
1275 | IncomingPacket incomingPacket = null; | 1341 | IncomingPacket incomingPacket = null; |
@@ -1312,6 +1378,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1312 | 1378 | ||
1313 | while (base.IsRunningOutbound) | 1379 | while (base.IsRunningOutbound) |
1314 | { | 1380 | { |
1381 | m_scene.ThreadAlive(2); | ||
1315 | try | 1382 | try |
1316 | { | 1383 | { |
1317 | m_packetSent = false; | 1384 | m_packetSent = false; |
@@ -1533,8 +1600,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1533 | Packet packet = incomingPacket.Packet; | 1600 | Packet packet = incomingPacket.Packet; |
1534 | LLClientView client = incomingPacket.Client; | 1601 | LLClientView client = incomingPacket.Client; |
1535 | 1602 | ||
1536 | if (client.IsActive) | 1603 | // if (client.IsActive) |
1537 | { | 1604 | // { |
1538 | m_currentIncomingClient = client; | 1605 | m_currentIncomingClient = client; |
1539 | 1606 | ||
1540 | try | 1607 | try |
@@ -1561,13 +1628,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1561 | { | 1628 | { |
1562 | m_currentIncomingClient = null; | 1629 | m_currentIncomingClient = null; |
1563 | } | 1630 | } |
1564 | } | 1631 | // } |
1565 | else | 1632 | // else |
1566 | { | 1633 | // { |
1567 | m_log.DebugFormat( | 1634 | // m_log.DebugFormat( |
1568 | "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", | 1635 | // "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", |
1569 | packet.Type, client.Name, m_scene.RegionInfo.RegionName); | 1636 | // packet.Type, client.Name, m_scene.RegionInfo.RegionName); |
1570 | } | 1637 | // } |
1571 | } | 1638 | } |
1572 | 1639 | ||
1573 | protected void LogoutHandler(IClientAPI client) | 1640 | protected void LogoutHandler(IClientAPI client) |
@@ -1577,8 +1644,116 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1577 | if (!client.IsLoggingOut) | 1644 | if (!client.IsLoggingOut) |
1578 | { | 1645 | { |
1579 | client.IsLoggingOut = true; | 1646 | client.IsLoggingOut = true; |
1580 | client.Close(); | 1647 | client.Close(false, false); |
1648 | } | ||
1649 | } | ||
1650 | } | ||
1651 | |||
1652 | internal class DoubleQueue<T> where T:class | ||
1653 | { | ||
1654 | private Queue<T> m_lowQueue = new Queue<T>(); | ||
1655 | private Queue<T> m_highQueue = new Queue<T>(); | ||
1656 | |||
1657 | private object m_syncRoot = new object(); | ||
1658 | private Semaphore m_s = new Semaphore(0, 1); | ||
1659 | |||
1660 | public DoubleQueue() | ||
1661 | { | ||
1662 | } | ||
1663 | |||
1664 | public virtual int Count | ||
1665 | { | ||
1666 | get { return m_highQueue.Count + m_lowQueue.Count; } | ||
1667 | } | ||
1668 | |||
1669 | public virtual void Enqueue(T data) | ||
1670 | { | ||
1671 | Enqueue(m_lowQueue, data); | ||
1672 | } | ||
1673 | |||
1674 | public virtual void EnqueueLow(T data) | ||
1675 | { | ||
1676 | Enqueue(m_lowQueue, data); | ||
1677 | } | ||
1678 | |||
1679 | public virtual void EnqueueHigh(T data) | ||
1680 | { | ||
1681 | Enqueue(m_highQueue, data); | ||
1682 | } | ||
1683 | |||
1684 | private void Enqueue(Queue<T> q, T data) | ||
1685 | { | ||
1686 | lock (m_syncRoot) | ||
1687 | { | ||
1688 | m_lowQueue.Enqueue(data); | ||
1689 | m_s.WaitOne(0); | ||
1690 | m_s.Release(); | ||
1691 | } | ||
1692 | } | ||
1693 | |||
1694 | public virtual T Dequeue() | ||
1695 | { | ||
1696 | return Dequeue(Timeout.Infinite); | ||
1697 | } | ||
1698 | |||
1699 | public virtual T Dequeue(int tmo) | ||
1700 | { | ||
1701 | return Dequeue(TimeSpan.FromMilliseconds(tmo)); | ||
1702 | } | ||
1703 | |||
1704 | public virtual T Dequeue(TimeSpan wait) | ||
1705 | { | ||
1706 | T res = null; | ||
1707 | |||
1708 | if (!Dequeue(wait, ref res)) | ||
1709 | return null; | ||
1710 | |||
1711 | return res; | ||
1712 | } | ||
1713 | |||
1714 | public bool Dequeue(int timeout, ref T res) | ||
1715 | { | ||
1716 | return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res); | ||
1717 | } | ||
1718 | |||
1719 | public bool Dequeue(TimeSpan wait, ref T res) | ||
1720 | { | ||
1721 | if (!m_s.WaitOne(wait)) | ||
1722 | return false; | ||
1723 | |||
1724 | lock (m_syncRoot) | ||
1725 | { | ||
1726 | if (m_highQueue.Count > 0) | ||
1727 | res = m_highQueue.Dequeue(); | ||
1728 | else | ||
1729 | res = m_lowQueue.Dequeue(); | ||
1730 | |||
1731 | if (m_highQueue.Count == 0 && m_lowQueue.Count == 0) | ||
1732 | return true; | ||
1733 | |||
1734 | try | ||
1735 | { | ||
1736 | m_s.Release(); | ||
1737 | } | ||
1738 | catch | ||
1739 | { | ||
1740 | } | ||
1741 | |||
1742 | return true; | ||
1743 | } | ||
1744 | } | ||
1745 | |||
1746 | public virtual void Clear() | ||
1747 | { | ||
1748 | |||
1749 | lock (m_syncRoot) | ||
1750 | { | ||
1751 | // Make sure sem count is 0 | ||
1752 | m_s.WaitOne(0); | ||
1753 | |||
1754 | m_lowQueue.Clear(); | ||
1755 | m_highQueue.Clear(); | ||
1581 | } | 1756 | } |
1582 | } | 1757 | } |
1583 | } | 1758 | } |
1584 | } \ No newline at end of file | 1759 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 6e6b3ef..e7d8a30 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | |||
@@ -118,10 +118,6 @@ namespace OpenMetaverse | |||
118 | const int SIO_UDP_CONNRESET = -1744830452; | 118 | const int SIO_UDP_CONNRESET = -1744830452; |
119 | 119 | ||
120 | IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort); | 120 | IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort); |
121 | |||
122 | m_log.DebugFormat( | ||
123 | "[UDPBASE]: Binding UDP listener using internal IP address config {0}:{1}", | ||
124 | ipep.Address, ipep.Port); | ||
125 | 121 | ||
126 | m_udpSocket = new Socket( | 122 | m_udpSocket = new Socket( |
127 | AddressFamily.InterNetwork, | 123 | AddressFamily.InterNetwork, |