diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 1479 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 115 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 122 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | 4 |
5 files changed, 1112 insertions, 611 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index a168bfe..dfc4419 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 e014471..9de564b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -101,6 +101,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
101 | public event AvatarPickerRequest OnAvatarPickerRequest; | 101 | public event AvatarPickerRequest OnAvatarPickerRequest; |
102 | public event StartAnim OnStartAnim; | 102 | public event StartAnim OnStartAnim; |
103 | public event StopAnim OnStopAnim; | 103 | public event StopAnim OnStopAnim; |
104 | public event ChangeAnim OnChangeAnim; | ||
104 | public event Action<IClientAPI> OnRequestAvatarsData; | 105 | public event Action<IClientAPI> OnRequestAvatarsData; |
105 | public event LinkObjects OnLinkObjects; | 106 | public event LinkObjects OnLinkObjects; |
106 | public event DelinkObjects OnDelinkObjects; | 107 | public event DelinkObjects OnDelinkObjects; |
@@ -128,6 +129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
128 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; | 129 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; |
129 | public event UpdatePrimFlags OnUpdatePrimFlags; | 130 | public event UpdatePrimFlags OnUpdatePrimFlags; |
130 | public event UpdatePrimTexture OnUpdatePrimTexture; | 131 | public event UpdatePrimTexture OnUpdatePrimTexture; |
132 | public event ClientChangeObject onClientChangeObject; | ||
131 | public event UpdateVector OnUpdatePrimGroupPosition; | 133 | public event UpdateVector OnUpdatePrimGroupPosition; |
132 | public event UpdateVector OnUpdatePrimSinglePosition; | 134 | public event UpdateVector OnUpdatePrimSinglePosition; |
133 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | 135 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; |
@@ -161,6 +163,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
161 | public event RequestTaskInventory OnRequestTaskInventory; | 163 | public event RequestTaskInventory OnRequestTaskInventory; |
162 | public event UpdateInventoryItem OnUpdateInventoryItem; | 164 | public event UpdateInventoryItem OnUpdateInventoryItem; |
163 | public event CopyInventoryItem OnCopyInventoryItem; | 165 | public event CopyInventoryItem OnCopyInventoryItem; |
166 | public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | ||
164 | public event MoveInventoryItem OnMoveInventoryItem; | 167 | public event MoveInventoryItem OnMoveInventoryItem; |
165 | public event RemoveInventoryItem OnRemoveInventoryItem; | 168 | public event RemoveInventoryItem OnRemoveInventoryItem; |
166 | public event RemoveInventoryFolder OnRemoveInventoryFolder; | 169 | public event RemoveInventoryFolder OnRemoveInventoryFolder; |
@@ -259,7 +262,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
259 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; | 262 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; |
260 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | 263 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; |
261 | public event ClassifiedDelete OnClassifiedDelete; | 264 | public event ClassifiedDelete OnClassifiedDelete; |
262 | public event ClassifiedDelete OnClassifiedGodDelete; | 265 | public event ClassifiedGodDelete OnClassifiedGodDelete; |
263 | public event EventNotificationAddRequest OnEventNotificationAddRequest; | 266 | public event EventNotificationAddRequest OnEventNotificationAddRequest; |
264 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | 267 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; |
265 | public event EventGodDelete OnEventGodDelete; | 268 | public event EventGodDelete OnEventGodDelete; |
@@ -290,10 +293,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
290 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; | 293 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; |
291 | public event SimWideDeletesDelegate OnSimWideDeletes; | 294 | public event SimWideDeletesDelegate OnSimWideDeletes; |
292 | public event SendPostcard OnSendPostcard; | 295 | public event SendPostcard OnSendPostcard; |
296 | public event ChangeInventoryItemFlags OnChangeInventoryItemFlags; | ||
293 | public event MuteListEntryUpdate OnUpdateMuteListEntry; | 297 | public event MuteListEntryUpdate OnUpdateMuteListEntry; |
294 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 298 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
295 | public event GodlikeMessage onGodlikeMessage; | 299 | public event GodlikeMessage onGodlikeMessage; |
296 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 300 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
301 | public event GenericCall2 OnUpdateThrottles; | ||
297 | 302 | ||
298 | #endregion Events | 303 | #endregion Events |
299 | 304 | ||
@@ -322,11 +327,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
322 | private readonly byte[] m_channelVersion = Utils.EmptyBytes; | 327 | private readonly byte[] m_channelVersion = Utils.EmptyBytes; |
323 | private readonly IGroupsModule m_GroupsModule; | 328 | private readonly IGroupsModule m_GroupsModule; |
324 | 329 | ||
330 | private int m_cachedTextureSerial; | ||
325 | private PriorityQueue m_entityUpdates; | 331 | private PriorityQueue m_entityUpdates; |
326 | private PriorityQueue m_entityProps; | 332 | private PriorityQueue m_entityProps; |
327 | private Prioritizer m_prioritizer; | 333 | private Prioritizer m_prioritizer; |
328 | private bool m_disableFacelights = false; | 334 | private bool m_disableFacelights = false; |
329 | 335 | ||
336 | private bool m_VelocityInterpolate = false; | ||
337 | private const uint MaxTransferBytesPerPacket = 600; | ||
338 | |||
339 | |||
330 | /// <value> | 340 | /// <value> |
331 | /// List used in construction of data blocks for an object update packet. This is to stop us having to | 341 | /// List used in construction of data blocks for an object update packet. This is to stop us having to |
332 | /// continually recreate it. | 342 | /// continually recreate it. |
@@ -338,14 +348,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
338 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an | 348 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an |
339 | /// ownerless phantom. | 349 | /// ownerless phantom. |
340 | /// | 350 | /// |
341 | /// All manipulation of this set has to occur under a lock | 351 | /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock |
342 | /// | 352 | /// |
343 | /// </value> | 353 | /// </value> |
344 | protected HashSet<uint> m_killRecord; | 354 | // protected HashSet<uint> m_killRecord; |
345 | 355 | ||
346 | // protected HashSet<uint> m_attachmentsSent; | 356 | // protected HashSet<uint> m_attachmentsSent; |
347 | 357 | ||
348 | private int m_moneyBalance; | 358 | private int m_moneyBalance; |
359 | private bool m_deliverPackets = true; | ||
349 | private int m_animationSequenceNumber = 1; | 360 | private int m_animationSequenceNumber = 1; |
350 | private bool m_SendLogoutPacketWhenClosing = true; | 361 | private bool m_SendLogoutPacketWhenClosing = true; |
351 | 362 | ||
@@ -392,6 +403,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
392 | get { return m_startpos; } | 403 | get { return m_startpos; } |
393 | set { m_startpos = value; } | 404 | set { m_startpos = value; } |
394 | } | 405 | } |
406 | public bool DeliverPackets | ||
407 | { | ||
408 | get { return m_deliverPackets; } | ||
409 | set { | ||
410 | m_deliverPackets = value; | ||
411 | m_udpClient.m_deliverPackets = value; | ||
412 | } | ||
413 | } | ||
395 | public UUID AgentId { get { return m_agentId; } } | 414 | public UUID AgentId { get { return m_agentId; } } |
396 | public ISceneAgent SceneAgent { get; set; } | 415 | public ISceneAgent SceneAgent { get; set; } |
397 | public UUID ActiveGroupId { get { return m_activeGroupID; } } | 416 | public UUID ActiveGroupId { get { return m_activeGroupID; } } |
@@ -443,6 +462,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
443 | } | 462 | } |
444 | 463 | ||
445 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } | 464 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } |
465 | |||
446 | 466 | ||
447 | #endregion Properties | 467 | #endregion Properties |
448 | 468 | ||
@@ -469,7 +489,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
469 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); | 489 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); |
470 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); | 490 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); |
471 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); | 491 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); |
472 | m_killRecord = new HashSet<uint>(); | 492 | // m_killRecord = new HashSet<uint>(); |
473 | // m_attachmentsSent = new HashSet<uint>(); | 493 | // m_attachmentsSent = new HashSet<uint>(); |
474 | 494 | ||
475 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | 495 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); |
@@ -499,12 +519,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
499 | 519 | ||
500 | #region Client Methods | 520 | #region Client Methods |
501 | 521 | ||
522 | |||
523 | /// <summary> | ||
524 | /// Close down the client view | ||
525 | /// </summary> | ||
502 | public void Close() | 526 | public void Close() |
503 | { | 527 | { |
504 | Close(false); | 528 | Close(true, false); |
505 | } | 529 | } |
506 | 530 | ||
507 | public void Close(bool force) | 531 | public void Close(bool sendStop, bool force) |
508 | { | 532 | { |
509 | // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. | 533 | // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. |
510 | // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. | 534 | // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. |
@@ -516,7 +540,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
516 | return; | 540 | return; |
517 | 541 | ||
518 | IsActive = false; | 542 | IsActive = false; |
519 | CloseWithoutChecks(); | 543 | CloseWithoutChecks(sendStop); |
520 | } | 544 | } |
521 | } | 545 | } |
522 | 546 | ||
@@ -529,12 +553,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
529 | /// | 553 | /// |
530 | /// Callers must lock ClosingSyncLock before calling. | 554 | /// Callers must lock ClosingSyncLock before calling. |
531 | /// </remarks> | 555 | /// </remarks> |
532 | public void CloseWithoutChecks() | 556 | public void CloseWithoutChecks(bool sendStop) |
533 | { | 557 | { |
534 | m_log.DebugFormat( | 558 | m_log.DebugFormat( |
535 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 559 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
536 | Name, m_scene.RegionInfo.RegionName); | 560 | Name, m_scene.RegionInfo.RegionName); |
537 | 561 | ||
562 | if (sendStop) | ||
563 | { | ||
564 | // Send the STOP packet | ||
565 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
566 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
567 | } | ||
568 | |||
538 | // Shutdown the image manager | 569 | // Shutdown the image manager |
539 | ImageManager.Close(); | 570 | ImageManager.Close(); |
540 | 571 | ||
@@ -557,6 +588,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
557 | // Disable UDP handling for this client | 588 | // Disable UDP handling for this client |
558 | m_udpClient.Shutdown(); | 589 | m_udpClient.Shutdown(); |
559 | 590 | ||
591 | |||
560 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 592 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
561 | //GC.Collect(); | 593 | //GC.Collect(); |
562 | //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 594 | //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
@@ -797,7 +829,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
797 | handshake.RegionInfo4[0].RegionFlagsExtended = args.regionFlags; | 829 | handshake.RegionInfo4[0].RegionFlagsExtended = args.regionFlags; |
798 | handshake.RegionInfo4[0].RegionProtocols = 0; // 1 here would indicate that SSB is supported | 830 | handshake.RegionInfo4[0].RegionProtocols = 0; // 1 here would indicate that SSB is supported |
799 | 831 | ||
800 | OutPacket(handshake, ThrottleOutPacketType.Task); | 832 | OutPacket(handshake, ThrottleOutPacketType.Unknown); |
801 | } | 833 | } |
802 | 834 | ||
803 | 835 | ||
@@ -838,7 +870,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
838 | reply.ChatData.OwnerID = ownerID; | 870 | reply.ChatData.OwnerID = ownerID; |
839 | reply.ChatData.SourceID = fromAgentID; | 871 | reply.ChatData.SourceID = fromAgentID; |
840 | 872 | ||
841 | OutPacket(reply, ThrottleOutPacketType.Task); | 873 | OutPacket(reply, ThrottleOutPacketType.Unknown); |
842 | } | 874 | } |
843 | 875 | ||
844 | /// <summary> | 876 | /// <summary> |
@@ -871,32 +903,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
871 | msg.MessageBlock.Message = Util.StringToBytes1024(im.message); | 903 | msg.MessageBlock.Message = Util.StringToBytes1024(im.message); |
872 | msg.MessageBlock.BinaryBucket = im.binaryBucket; | 904 | msg.MessageBlock.BinaryBucket = im.binaryBucket; |
873 | 905 | ||
874 | if (im.message.StartsWith("[grouptest]")) | 906 | OutPacket(msg, ThrottleOutPacketType.Task); |
875 | { // this block is test code for implementing group IM - delete when group IM is finished | ||
876 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | ||
877 | if (eq != null) | ||
878 | { | ||
879 | im.dialog = 17; | ||
880 | |||
881 | //eq.ChatterboxInvitation( | ||
882 | // new UUID("00000000-68f9-1111-024e-222222111123"), | ||
883 | // "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0, | ||
884 | // false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket); | ||
885 | |||
886 | eq.ChatterboxInvitation( | ||
887 | new UUID("00000000-68f9-1111-024e-222222111123"), | ||
888 | "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0, | ||
889 | false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing")); | ||
890 | |||
891 | eq.ChatterBoxSessionAgentListUpdates( | ||
892 | new UUID("00000000-68f9-1111-024e-222222111123"), | ||
893 | new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false); | ||
894 | } | ||
895 | |||
896 | Console.WriteLine("SendInstantMessage: " + msg); | ||
897 | } | ||
898 | else | ||
899 | OutPacket(msg, ThrottleOutPacketType.Task); | ||
900 | } | 907 | } |
901 | } | 908 | } |
902 | 909 | ||
@@ -1134,6 +1141,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1134 | public virtual void SendLayerData(float[] map) | 1141 | public virtual void SendLayerData(float[] map) |
1135 | { | 1142 | { |
1136 | Util.FireAndForget(DoSendLayerData, map); | 1143 | Util.FireAndForget(DoSendLayerData, map); |
1144 | |||
1145 | // Send it sync, and async. It's not that much data | ||
1146 | // and it improves user experience just so much! | ||
1147 | DoSendLayerData(map); | ||
1137 | } | 1148 | } |
1138 | 1149 | ||
1139 | /// <summary> | 1150 | /// <summary> |
@@ -1146,16 +1157,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1146 | 1157 | ||
1147 | try | 1158 | try |
1148 | { | 1159 | { |
1149 | //for (int y = 0; y < 16; y++) | 1160 | for (int y = 0; y < 16; y++) |
1150 | //{ | 1161 | { |
1151 | // for (int x = 0; x < 16; x++) | 1162 | for (int x = 0; x < 16; x+=4) |
1152 | // { | 1163 | { |
1153 | // SendLayerData(x, y, map); | 1164 | SendLayerPacket(x, y, map); |
1154 | // } | 1165 | } |
1155 | //} | 1166 | } |
1156 | |||
1157 | // Send LayerData in a spiral pattern. Fun! | ||
1158 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
1159 | } | 1167 | } |
1160 | catch (Exception e) | 1168 | catch (Exception e) |
1161 | { | 1169 | { |
@@ -1163,51 +1171,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1163 | } | 1171 | } |
1164 | } | 1172 | } |
1165 | 1173 | ||
1166 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
1167 | { | ||
1168 | // Row | ||
1169 | for (int i = x1; i <= x2; i++) | ||
1170 | SendLayerData(i, y1, map); | ||
1171 | |||
1172 | // Column | ||
1173 | for (int j = y1 + 1; j <= y2; j++) | ||
1174 | SendLayerData(x2, j, map); | ||
1175 | |||
1176 | if (x2 - x1 > 0) | ||
1177 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
1178 | } | ||
1179 | |||
1180 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
1181 | { | ||
1182 | // Row in reverse | ||
1183 | for (int i = x2; i >= x1; i--) | ||
1184 | SendLayerData(i, y2, map); | ||
1185 | |||
1186 | // Column in reverse | ||
1187 | for (int j = y2 - 1; j >= y1; j--) | ||
1188 | SendLayerData(x1, j, map); | ||
1189 | |||
1190 | if (x2 - x1 > 0) | ||
1191 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
1192 | } | ||
1193 | |||
1194 | /// <summary> | 1174 | /// <summary> |
1195 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 1175 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
1196 | /// </summary> | 1176 | /// </summary> |
1197 | /// <param name="map">heightmap</param> | 1177 | /// <param name="map">heightmap</param> |
1198 | /// <param name="px">X coordinate for patches 0..12</param> | 1178 | /// <param name="px">X coordinate for patches 0..12</param> |
1199 | /// <param name="py">Y coordinate for patches 0..15</param> | 1179 | /// <param name="py">Y coordinate for patches 0..15</param> |
1200 | // private void SendLayerPacket(float[] map, int y, int x) | 1180 | private void SendLayerPacket(int x, int y, float[] map) |
1201 | // { | 1181 | { |
1202 | // int[] patches = new int[4]; | 1182 | int[] patches = new int[4]; |
1203 | // patches[0] = x + 0 + y * 16; | 1183 | patches[0] = x + 0 + y * 16; |
1204 | // patches[1] = x + 1 + y * 16; | 1184 | patches[1] = x + 1 + y * 16; |
1205 | // patches[2] = x + 2 + y * 16; | 1185 | patches[2] = x + 2 + y * 16; |
1206 | // patches[3] = x + 3 + y * 16; | 1186 | patches[3] = x + 3 + y * 16; |
1207 | 1187 | ||
1208 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 1188 | float[] heightmap = (map.Length == 65536) ? |
1209 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1189 | map : |
1210 | // } | 1190 | LLHeightFieldMoronize(map); |
1191 | |||
1192 | try | ||
1193 | { | ||
1194 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1195 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1196 | } | ||
1197 | catch | ||
1198 | { | ||
1199 | for (int px = x ; px < x + 4 ; px++) | ||
1200 | SendLayerData(px, y, map); | ||
1201 | } | ||
1202 | } | ||
1211 | 1203 | ||
1212 | /// <summary> | 1204 | /// <summary> |
1213 | /// Sends a specified patch to a client | 1205 | /// Sends a specified patch to a client |
@@ -1227,7 +1219,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1227 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 1219 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); |
1228 | layerpack.Header.Reliable = true; | 1220 | layerpack.Header.Reliable = true; |
1229 | 1221 | ||
1230 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1222 | OutPacket(layerpack, ThrottleOutPacketType.Task); |
1231 | } | 1223 | } |
1232 | catch (Exception e) | 1224 | catch (Exception e) |
1233 | { | 1225 | { |
@@ -1590,7 +1582,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1590 | 1582 | ||
1591 | public void SendKillObject(List<uint> localIDs) | 1583 | public void SendKillObject(List<uint> localIDs) |
1592 | { | 1584 | { |
1593 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); | 1585 | // foreach (uint id in localIDs) |
1586 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); | ||
1594 | 1587 | ||
1595 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); | 1588 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); |
1596 | // TODO: don't create new blocks if recycling an old packet | 1589 | // TODO: don't create new blocks if recycling an old packet |
@@ -1612,17 +1605,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1612 | // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race | 1605 | // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race |
1613 | // condition where a kill can be processed before an out-of-date update for the same object. | 1606 | // condition where a kill can be processed before an out-of-date update for the same object. |
1614 | // ProcessEntityUpdates() also takes the m_killRecord lock. | 1607 | // ProcessEntityUpdates() also takes the m_killRecord lock. |
1615 | lock (m_killRecord) | 1608 | // lock (m_killRecord) |
1616 | { | 1609 | // { |
1617 | foreach (uint localID in localIDs) | 1610 | // foreach (uint localID in localIDs) |
1618 | m_killRecord.Add(localID); | 1611 | // m_killRecord.Add(localID); |
1619 | 1612 | ||
1620 | // The throttle queue used here must match that being used for updates. Otherwise, there is a | 1613 | // The throttle queue used here must match that being used for updates. Otherwise, there is a |
1621 | // chance that a kill packet put on a separate queue will be sent to the client before an existing | 1614 | // chance that a kill packet put on a separate queue will be sent to the client before an existing |
1622 | // update packet on another queue. Receiving updates after kills results in unowned and undeletable | 1615 | // update packet on another queue. Receiving updates after kills results in unowned and undeletable |
1623 | // scene objects in a viewer until that viewer is relogged in. | 1616 | // scene objects in a viewer until that viewer is relogged in. |
1624 | OutPacket(kill, ThrottleOutPacketType.Task); | 1617 | OutPacket(kill, ThrottleOutPacketType.Task); |
1625 | } | 1618 | // } |
1626 | } | 1619 | } |
1627 | } | 1620 | } |
1628 | 1621 | ||
@@ -2081,9 +2074,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2081 | OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); | 2074 | OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); |
2082 | } | 2075 | } |
2083 | 2076 | ||
2084 | /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> | ||
2085 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) | 2077 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) |
2086 | { | 2078 | { |
2079 | SendInventoryItemCreateUpdate(Item, UUID.Zero, callbackId); | ||
2080 | } | ||
2081 | |||
2082 | /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> | ||
2083 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId) | ||
2084 | { | ||
2087 | const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; | 2085 | const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; |
2088 | 2086 | ||
2089 | UpdateCreateInventoryItemPacket InventoryReply | 2087 | UpdateCreateInventoryItemPacket InventoryReply |
@@ -2093,6 +2091,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2093 | // TODO: don't create new blocks if recycling an old packet | 2091 | // TODO: don't create new blocks if recycling an old packet |
2094 | InventoryReply.AgentData.AgentID = AgentId; | 2092 | InventoryReply.AgentData.AgentID = AgentId; |
2095 | InventoryReply.AgentData.SimApproved = true; | 2093 | InventoryReply.AgentData.SimApproved = true; |
2094 | InventoryReply.AgentData.TransactionID = transactionID; | ||
2096 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; | 2095 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; |
2097 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); | 2096 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); |
2098 | InventoryReply.InventoryData[0].ItemID = Item.ID; | 2097 | InventoryReply.InventoryData[0].ItemID = Item.ID; |
@@ -2162,16 +2161,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2162 | replytask.InventoryData.TaskID = taskID; | 2161 | replytask.InventoryData.TaskID = taskID; |
2163 | replytask.InventoryData.Serial = serial; | 2162 | replytask.InventoryData.Serial = serial; |
2164 | replytask.InventoryData.Filename = fileName; | 2163 | replytask.InventoryData.Filename = fileName; |
2165 | OutPacket(replytask, ThrottleOutPacketType.Asset); | 2164 | OutPacket(replytask, ThrottleOutPacketType.Task); |
2166 | } | 2165 | } |
2167 | 2166 | ||
2168 | public void SendXferPacket(ulong xferID, uint packet, byte[] data) | 2167 | public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) |
2169 | { | 2168 | { |
2169 | ThrottleOutPacketType type = ThrottleOutPacketType.Asset; | ||
2170 | if (isTaskInventory) | ||
2171 | type = ThrottleOutPacketType.Task; | ||
2172 | |||
2170 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); | 2173 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); |
2171 | sendXfer.XferID.ID = xferID; | 2174 | sendXfer.XferID.ID = xferID; |
2172 | sendXfer.XferID.Packet = packet; | 2175 | sendXfer.XferID.Packet = packet; |
2173 | sendXfer.DataPacket.Data = data; | 2176 | sendXfer.DataPacket.Data = data; |
2174 | OutPacket(sendXfer, ThrottleOutPacketType.Asset); | 2177 | OutPacket(sendXfer, type); |
2175 | } | 2178 | } |
2176 | 2179 | ||
2177 | public void SendAbortXferPacket(ulong xferID) | 2180 | public void SendAbortXferPacket(ulong xferID) |
@@ -2353,6 +2356,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2353 | OutPacket(sound, ThrottleOutPacketType.Task); | 2356 | OutPacket(sound, ThrottleOutPacketType.Task); |
2354 | } | 2357 | } |
2355 | 2358 | ||
2359 | public void SendTransferAbort(TransferRequestPacket transferRequest) | ||
2360 | { | ||
2361 | TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort); | ||
2362 | abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID; | ||
2363 | abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType; | ||
2364 | m_log.Debug("[Assets] Aborting transfer; asset request failed"); | ||
2365 | OutPacket(abort, ThrottleOutPacketType.Task); | ||
2366 | } | ||
2367 | |||
2356 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) | 2368 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) |
2357 | { | 2369 | { |
2358 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); | 2370 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); |
@@ -2661,6 +2673,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2661 | float friction = part.Friction; | 2673 | float friction = part.Friction; |
2662 | float bounce = part.Restitution; | 2674 | float bounce = part.Restitution; |
2663 | float gravmod = part.GravityModifier; | 2675 | float gravmod = part.GravityModifier; |
2676 | |||
2664 | eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); | 2677 | eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); |
2665 | } | 2678 | } |
2666 | } | 2679 | } |
@@ -2731,8 +2744,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2731 | req.AssetInf.ID, req.AssetInf.Metadata.ContentType); | 2744 | req.AssetInf.ID, req.AssetInf.Metadata.ContentType); |
2732 | return; | 2745 | return; |
2733 | } | 2746 | } |
2747 | int WearableOut = 0; | ||
2748 | bool isWearable = false; | ||
2749 | |||
2750 | if (req.AssetInf != null) | ||
2751 | isWearable = | ||
2752 | ((AssetType) req.AssetInf.Type == | ||
2753 | AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); | ||
2734 | 2754 | ||
2735 | //m_log.Debug("sending asset " + req.RequestAssetID); | 2755 | |
2756 | //m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); | ||
2757 | |||
2758 | |||
2759 | //if (isWearable) | ||
2760 | // m_log.Debug((AssetType)req.AssetInf.Type); | ||
2761 | |||
2736 | TransferInfoPacket Transfer = new TransferInfoPacket(); | 2762 | TransferInfoPacket Transfer = new TransferInfoPacket(); |
2737 | Transfer.TransferInfo.ChannelType = 2; | 2763 | Transfer.TransferInfo.ChannelType = 2; |
2738 | Transfer.TransferInfo.Status = 0; | 2764 | Transfer.TransferInfo.Status = 0; |
@@ -2754,7 +2780,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2754 | Transfer.TransferInfo.Size = req.AssetInf.Data.Length; | 2780 | Transfer.TransferInfo.Size = req.AssetInf.Data.Length; |
2755 | Transfer.TransferInfo.TransferID = req.TransferRequestID; | 2781 | Transfer.TransferInfo.TransferID = req.TransferRequestID; |
2756 | Transfer.Header.Zerocoded = true; | 2782 | Transfer.Header.Zerocoded = true; |
2757 | OutPacket(Transfer, ThrottleOutPacketType.Asset); | 2783 | OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); |
2758 | 2784 | ||
2759 | if (req.NumPackets == 1) | 2785 | if (req.NumPackets == 1) |
2760 | { | 2786 | { |
@@ -2765,12 +2791,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2765 | TransferPacket.TransferData.Data = req.AssetInf.Data; | 2791 | TransferPacket.TransferData.Data = req.AssetInf.Data; |
2766 | TransferPacket.TransferData.Status = 1; | 2792 | TransferPacket.TransferData.Status = 1; |
2767 | TransferPacket.Header.Zerocoded = true; | 2793 | TransferPacket.Header.Zerocoded = true; |
2768 | OutPacket(TransferPacket, ThrottleOutPacketType.Asset); | 2794 | OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); |
2769 | } | 2795 | } |
2770 | else | 2796 | else |
2771 | { | 2797 | { |
2772 | int processedLength = 0; | 2798 | int processedLength = 0; |
2773 | int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; | 2799 | // int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; |
2800 | |||
2801 | int maxChunkSize = (int) MaxTransferBytesPerPacket; | ||
2774 | int packetNumber = 0; | 2802 | int packetNumber = 0; |
2775 | 2803 | ||
2776 | while (processedLength < req.AssetInf.Data.Length) | 2804 | while (processedLength < req.AssetInf.Data.Length) |
@@ -2796,7 +2824,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2796 | TransferPacket.TransferData.Status = 1; | 2824 | TransferPacket.TransferData.Status = 1; |
2797 | } | 2825 | } |
2798 | TransferPacket.Header.Zerocoded = true; | 2826 | TransferPacket.Header.Zerocoded = true; |
2799 | OutPacket(TransferPacket, ThrottleOutPacketType.Asset); | 2827 | OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); |
2800 | 2828 | ||
2801 | processedLength += chunkSize; | 2829 | processedLength += chunkSize; |
2802 | packetNumber++; | 2830 | packetNumber++; |
@@ -2841,7 +2869,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2841 | reply.Data.ParcelID = parcelID; | 2869 | reply.Data.ParcelID = parcelID; |
2842 | reply.Data.OwnerID = land.OwnerID; | 2870 | reply.Data.OwnerID = land.OwnerID; |
2843 | reply.Data.Name = Utils.StringToBytes(land.Name); | 2871 | reply.Data.Name = Utils.StringToBytes(land.Name); |
2844 | reply.Data.Desc = Utils.StringToBytes(land.Description); | 2872 | if (land != null && land.Description != null && land.Description != String.Empty) |
2873 | reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); | ||
2874 | else | ||
2875 | reply.Data.Desc = new Byte[0]; | ||
2845 | reply.Data.ActualArea = land.Area; | 2876 | reply.Data.ActualArea = land.Area; |
2846 | reply.Data.BillableArea = land.Area; // TODO: what is this? | 2877 | reply.Data.BillableArea = land.Area; // TODO: what is this? |
2847 | 2878 | ||
@@ -3548,24 +3579,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3548 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; | 3579 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; |
3549 | AgentWearablesUpdatePacket.WearableDataBlock awb; | 3580 | AgentWearablesUpdatePacket.WearableDataBlock awb; |
3550 | int idx = 0; | 3581 | int idx = 0; |
3551 | for (int i = 0; i < wearables.Length; i++) | 3582 | |
3552 | { | 3583 | for (int i = 0; i < wearables.Length; i++) |
3553 | for (int j = 0; j < wearables[i].Count; j++) | 3584 | { |
3554 | { | 3585 | for (int j = 0; j < wearables[i].Count; j++) |
3555 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | 3586 | { |
3556 | awb.WearableType = (byte)i; | 3587 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); |
3557 | awb.AssetID = wearables[i][j].AssetID; | 3588 | awb.WearableType = (byte) i; |
3558 | awb.ItemID = wearables[i][j].ItemID; | 3589 | awb.AssetID = wearables[i][j].AssetID; |
3559 | aw.WearableData[idx] = awb; | 3590 | awb.ItemID = wearables[i][j].ItemID; |
3560 | idx++; | 3591 | aw.WearableData[idx] = awb; |
3561 | 3592 | idx++; | |
3562 | // m_log.DebugFormat( | 3593 | |
3563 | // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", | 3594 | // m_log.DebugFormat( |
3564 | // awb.ItemID, awb.AssetID, i, Name); | 3595 | // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", |
3565 | } | 3596 | // awb.ItemID, awb.AssetID, i, Name); |
3566 | } | 3597 | } |
3598 | } | ||
3567 | 3599 | ||
3568 | OutPacket(aw, ThrottleOutPacketType.Task); | 3600 | OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); |
3569 | } | 3601 | } |
3570 | 3602 | ||
3571 | public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) | 3603 | public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) |
@@ -3576,7 +3608,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3576 | 3608 | ||
3577 | AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); | 3609 | AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); |
3578 | // TODO: don't create new blocks if recycling an old packet | 3610 | // TODO: don't create new blocks if recycling an old packet |
3579 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | 3611 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length]; |
3580 | avp.ObjectData.TextureEntry = textureEntry; | 3612 | avp.ObjectData.TextureEntry = textureEntry; |
3581 | 3613 | ||
3582 | AvatarAppearancePacket.VisualParamBlock avblock = null; | 3614 | AvatarAppearancePacket.VisualParamBlock avblock = null; |
@@ -3707,7 +3739,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3707 | /// </summary> | 3739 | /// </summary> |
3708 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) | 3740 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) |
3709 | { | 3741 | { |
3710 | //double priority = m_prioritizer.GetUpdatePriority(this, entity); | 3742 | if (entity is SceneObjectPart) |
3743 | { | ||
3744 | SceneObjectPart e = (SceneObjectPart)entity; | ||
3745 | SceneObjectGroup g = e.ParentGroup; | ||
3746 | if (g.RootPart.Shape.State > 30) // HUD | ||
3747 | if (g.OwnerID != AgentId) | ||
3748 | return; // Don't send updates for other people's HUDs | ||
3749 | } | ||
3750 | |||
3711 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); | 3751 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); |
3712 | 3752 | ||
3713 | lock (m_entityUpdates.SyncRoot) | 3753 | lock (m_entityUpdates.SyncRoot) |
@@ -3774,27 +3814,74 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3774 | 3814 | ||
3775 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race | 3815 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race |
3776 | // condition where a kill can be processed before an out-of-date update for the same object. | 3816 | // condition where a kill can be processed before an out-of-date update for the same object. |
3777 | lock (m_killRecord) | 3817 | float avgTimeDilation = 1.0f; |
3818 | IEntityUpdate iupdate; | ||
3819 | Int32 timeinqueue; // this is just debugging code & can be dropped later | ||
3820 | |||
3821 | while (updatesThisCall < maxUpdates) | ||
3778 | { | 3822 | { |
3779 | float avgTimeDilation = 1.0f; | 3823 | lock (m_entityUpdates.SyncRoot) |
3780 | IEntityUpdate iupdate; | 3824 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) |
3781 | Int32 timeinqueue; // this is just debugging code & can be dropped later | 3825 | break; |
3826 | |||
3827 | EntityUpdate update = (EntityUpdate)iupdate; | ||
3828 | |||
3829 | avgTimeDilation += update.TimeDilation; | ||
3830 | avgTimeDilation *= 0.5f; | ||
3782 | 3831 | ||
3783 | while (updatesThisCall < maxUpdates) | 3832 | if (update.Entity is SceneObjectPart) |
3784 | { | 3833 | { |
3785 | lock (m_entityUpdates.SyncRoot) | 3834 | SceneObjectPart part = (SceneObjectPart)update.Entity; |
3786 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) | ||
3787 | break; | ||
3788 | 3835 | ||
3789 | EntityUpdate update = (EntityUpdate)iupdate; | 3836 | if (part.ParentGroup.IsDeleted) |
3790 | 3837 | continue; | |
3791 | avgTimeDilation += update.TimeDilation; | ||
3792 | avgTimeDilation *= 0.5f; | ||
3793 | 3838 | ||
3794 | if (update.Entity is SceneObjectPart) | 3839 | if (part.ParentGroup.IsAttachment) |
3840 | { // Someone else's HUD, why are we getting these? | ||
3841 | if (part.ParentGroup.OwnerID != AgentId && | ||
3842 | part.ParentGroup.RootPart.Shape.State > 30) | ||
3843 | continue; | ||
3844 | ScenePresence sp; | ||
3845 | // Owner is not in the sim, don't update it to | ||
3846 | // anyone | ||
3847 | if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) | ||
3848 | continue; | ||
3849 | |||
3850 | List<SceneObjectGroup> atts = sp.GetAttachments(); | ||
3851 | bool found = false; | ||
3852 | foreach (SceneObjectGroup att in atts) | ||
3853 | { | ||
3854 | if (att == part.ParentGroup) | ||
3855 | { | ||
3856 | found = true; | ||
3857 | break; | ||
3858 | } | ||
3859 | } | ||
3860 | |||
3861 | // It's an attachment of a valid avatar, but | ||
3862 | // doesn't seem to be attached, skip | ||
3863 | if (!found) | ||
3864 | continue; | ||
3865 | |||
3866 | // On vehicle crossing, the attachments are received | ||
3867 | // while the avatar is still a child. Don't send | ||
3868 | // updates here because the LocalId has not yet | ||
3869 | // been updated and the viewer will derender the | ||
3870 | // attachments until the avatar becomes root. | ||
3871 | if (sp.IsChildAgent) | ||
3872 | continue; | ||
3873 | |||
3874 | // If the object is an attachment we don't want it to be in the kill | ||
3875 | // record. Else attaching from inworld and subsequently dropping | ||
3876 | // it will no longer work. | ||
3877 | // lock (m_killRecord) | ||
3878 | // { | ||
3879 | // m_killRecord.Remove(part.LocalId); | ||
3880 | // m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); | ||
3881 | // } | ||
3882 | } | ||
3883 | else | ||
3795 | { | 3884 | { |
3796 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3797 | |||
3798 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client | 3885 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client |
3799 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good | 3886 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good |
3800 | // safety measure. | 3887 | // safety measure. |
@@ -3805,21 +3892,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3805 | // | 3892 | // |
3806 | // This doesn't appear to apply to child prims - a client will happily ignore these updates | 3893 | // This doesn't appear to apply to child prims - a client will happily ignore these updates |
3807 | // after the root prim has been deleted. | 3894 | // after the root prim has been deleted. |
3808 | if (m_killRecord.Contains(part.LocalId)) | 3895 | // |
3809 | { | 3896 | // We ignore this for attachments because attaching something from inworld breaks unless we do. |
3810 | // m_log.WarnFormat( | 3897 | // lock (m_killRecord) |
3811 | // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", | 3898 | // { |
3812 | // part.LocalId, Name); | 3899 | // if (m_killRecord.Contains(part.LocalId)) |
3813 | continue; | 3900 | // continue; |
3814 | } | 3901 | // if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) |
3815 | 3902 | // continue; | |
3816 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | 3903 | // } |
3904 | } | ||
3905 | |||
3906 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | ||
3907 | { | ||
3908 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | ||
3909 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3817 | { | 3910 | { |
3818 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | 3911 | part.Shape.LightEntry = false; |
3819 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3820 | { | ||
3821 | part.Shape.LightEntry = false; | ||
3822 | } | ||
3823 | } | 3912 | } |
3824 | 3913 | ||
3825 | if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) | 3914 | if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) |
@@ -3830,224 +3919,166 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3830 | part.Shape.ProfileHollow = 27500; | 3919 | part.Shape.ProfileHollow = 27500; |
3831 | } | 3920 | } |
3832 | } | 3921 | } |
3833 | 3922 | ||
3834 | #region UpdateFlags to packet type conversion | 3923 | if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) |
3835 | |||
3836 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | ||
3837 | |||
3838 | bool canUseCompressed = true; | ||
3839 | bool canUseImproved = true; | ||
3840 | |||
3841 | // Compressed object updates only make sense for LL primitives | ||
3842 | if (!(update.Entity is SceneObjectPart)) | ||
3843 | { | 3924 | { |
3844 | canUseCompressed = false; | 3925 | // Ensure that mesh has at least 8 valid faces |
3926 | part.Shape.ProfileBegin = 12500; | ||
3927 | part.Shape.ProfileEnd = 0; | ||
3928 | part.Shape.ProfileHollow = 27500; | ||
3845 | } | 3929 | } |
3846 | 3930 | } | |
3847 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | 3931 | |
3932 | ++updatesThisCall; | ||
3933 | |||
3934 | #region UpdateFlags to packet type conversion | ||
3935 | |||
3936 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | ||
3937 | |||
3938 | bool canUseCompressed = true; | ||
3939 | bool canUseImproved = true; | ||
3940 | |||
3941 | // Compressed object updates only make sense for LL primitives | ||
3942 | if (!(update.Entity is SceneObjectPart)) | ||
3943 | { | ||
3944 | canUseCompressed = false; | ||
3945 | } | ||
3946 | |||
3947 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | ||
3948 | { | ||
3949 | canUseCompressed = false; | ||
3950 | canUseImproved = false; | ||
3951 | } | ||
3952 | else | ||
3953 | { | ||
3954 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | ||
3955 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
3956 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3957 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3848 | { | 3958 | { |
3849 | canUseCompressed = false; | 3959 | canUseCompressed = false; |
3850 | canUseImproved = false; | ||
3851 | } | 3960 | } |
3852 | else | 3961 | |
3962 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
3963 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3964 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3965 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3966 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3967 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3968 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3969 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3970 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3971 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3972 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3973 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3974 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3975 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3853 | { | 3976 | { |
3854 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | 3977 | canUseImproved = false; |
3855 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
3856 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3857 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3858 | { | ||
3859 | canUseCompressed = false; | ||
3860 | } | ||
3861 | |||
3862 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
3863 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3864 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3865 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3866 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3867 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3868 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3869 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3870 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3871 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3872 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3873 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3874 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3875 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3876 | { | ||
3877 | canUseImproved = false; | ||
3878 | } | ||
3879 | } | 3978 | } |
3979 | } | ||
3880 | 3980 | ||
3881 | #endregion UpdateFlags to packet type conversion | 3981 | #endregion UpdateFlags to packet type conversion |
3882 | |||
3883 | #region Block Construction | ||
3884 | |||
3885 | // TODO: Remove this once we can build compressed updates | ||
3886 | canUseCompressed = false; | ||
3887 | |||
3888 | if (!canUseImproved && !canUseCompressed) | ||
3889 | { | ||
3890 | ObjectUpdatePacket.ObjectDataBlock updateBlock; | ||
3891 | 3982 | ||
3892 | if (update.Entity is ScenePresence) | 3983 | #region Block Construction |
3893 | { | ||
3894 | updateBlock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); | ||
3895 | } | ||
3896 | else | ||
3897 | { | ||
3898 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3899 | updateBlock = CreatePrimUpdateBlock(part, AgentId); | ||
3900 | |||
3901 | // If the part has become a private hud since the update was scheduled then we do not | ||
3902 | // want to send it to other avatars. | ||
3903 | if (part.ParentGroup.IsAttachment | ||
3904 | && part.ParentGroup.HasPrivateAttachmentPoint | ||
3905 | && part.ParentGroup.AttachedAvatar != AgentId) | ||
3906 | continue; | ||
3907 | |||
3908 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3909 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3910 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3911 | // of the test above). | ||
3912 | // | ||
3913 | // Actual deletions (kills) happen in another method. | ||
3914 | if (part.ParentGroup.IsDeleted) | ||
3915 | continue; | ||
3916 | } | ||
3917 | 3984 | ||
3918 | objectUpdateBlocks.Value.Add(updateBlock); | 3985 | // TODO: Remove this once we can build compressed updates |
3919 | objectUpdates.Value.Add(update); | 3986 | canUseCompressed = false; |
3920 | } | ||
3921 | else if (!canUseImproved) | ||
3922 | { | ||
3923 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3924 | ObjectUpdateCompressedPacket.ObjectDataBlock compressedBlock | ||
3925 | = CreateCompressedUpdateBlock(part, updateFlags); | ||
3926 | |||
3927 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3928 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3929 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3930 | // of the test above). | ||
3931 | // | ||
3932 | // Actual deletions (kills) happen in another method. | ||
3933 | if (part.ParentGroup.IsDeleted) | ||
3934 | continue; | ||
3935 | 3987 | ||
3936 | compressedUpdateBlocks.Value.Add(compressedBlock); | 3988 | if (!canUseImproved && !canUseCompressed) |
3937 | compressedUpdates.Value.Add(update); | 3989 | { |
3990 | if (update.Entity is ScenePresence) | ||
3991 | { | ||
3992 | objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); | ||
3938 | } | 3993 | } |
3939 | else | 3994 | else |
3940 | { | 3995 | { |
3941 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) | 3996 | objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); |
3942 | { | ||
3943 | // Self updates go into a special list | ||
3944 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3945 | terseAgentUpdates.Value.Add(update); | ||
3946 | } | ||
3947 | else | ||
3948 | { | ||
3949 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseUpdateBlock | ||
3950 | = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); | ||
3951 | |||
3952 | // Everything else goes here | ||
3953 | if (update.Entity is SceneObjectPart) | ||
3954 | { | ||
3955 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3956 | |||
3957 | // If the part has become a private hud since the update was scheduled then we do not | ||
3958 | // want to send it to other avatars. | ||
3959 | if (part.ParentGroup.IsAttachment | ||
3960 | && part.ParentGroup.HasPrivateAttachmentPoint | ||
3961 | && part.ParentGroup.AttachedAvatar != AgentId) | ||
3962 | continue; | ||
3963 | |||
3964 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3965 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3966 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3967 | // of the test above). | ||
3968 | // | ||
3969 | // Actual deletions (kills) happen in another method. | ||
3970 | if (part.ParentGroup.IsDeleted) | ||
3971 | continue; | ||
3972 | } | ||
3973 | |||
3974 | terseUpdateBlocks.Value.Add(terseUpdateBlock); | ||
3975 | terseUpdates.Value.Add(update); | ||
3976 | } | ||
3977 | } | 3997 | } |
3978 | |||
3979 | ++updatesThisCall; | ||
3980 | |||
3981 | #endregion Block Construction | ||
3982 | } | 3998 | } |
3983 | 3999 | else if (!canUseImproved) | |
3984 | #region Packet Sending | ||
3985 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | ||
3986 | |||
3987 | if (terseAgentUpdateBlocks.IsValueCreated) | ||
3988 | { | 4000 | { |
3989 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | 4001 | compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); |
4002 | } | ||
4003 | else | ||
4004 | { | ||
4005 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) | ||
4006 | // Self updates go into a special list | ||
4007 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
4008 | else | ||
4009 | // Everything else goes here | ||
4010 | terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
4011 | } | ||
3990 | 4012 | ||
3991 | ImprovedTerseObjectUpdatePacket packet | 4013 | #endregion Block Construction |
3992 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); | 4014 | } |
3993 | 4015 | ||
3994 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4016 | #region Packet Sending |
3995 | packet.RegionData.TimeDilation = timeDilation; | 4017 | |
3996 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 4018 | const float TIME_DILATION = 1.0f; |
4019 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | ||
4020 | |||
4021 | if (terseAgentUpdateBlocks.IsValueCreated) | ||
4022 | { | ||
4023 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | ||
3997 | 4024 | ||
3998 | for (int i = 0; i < blocks.Count; i++) | 4025 | ImprovedTerseObjectUpdatePacket packet |
3999 | packet.ObjectData[i] = blocks[i]; | 4026 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); |
4000 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | 4027 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
4001 | OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); | 4028 | packet.RegionData.TimeDilation = timeDilation; |
4002 | } | 4029 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; |
4003 | 4030 | ||
4004 | if (objectUpdateBlocks.IsValueCreated) | 4031 | for (int i = 0; i < blocks.Count; i++) |
4005 | { | 4032 | packet.ObjectData[i] = blocks[i]; |
4006 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; | ||
4007 | |||
4008 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | ||
4009 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4010 | packet.RegionData.TimeDilation = timeDilation; | ||
4011 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4012 | |||
4013 | for (int i = 0; i < blocks.Count; i++) | ||
4014 | packet.ObjectData[i] = blocks[i]; | ||
4015 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
4016 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); | ||
4017 | } | ||
4018 | |||
4019 | if (compressedUpdateBlocks.IsValueCreated) | ||
4020 | { | ||
4021 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
4022 | |||
4023 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
4024 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4025 | packet.RegionData.TimeDilation = timeDilation; | ||
4026 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
4027 | |||
4028 | for (int i = 0; i < blocks.Count; i++) | ||
4029 | packet.ObjectData[i] = blocks[i]; | ||
4030 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
4031 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); | ||
4032 | } | ||
4033 | 4033 | ||
4034 | if (terseUpdateBlocks.IsValueCreated) | 4034 | OutPacket(packet, ThrottleOutPacketType.Unknown, true); |
4035 | { | 4035 | } |
4036 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
4037 | |||
4038 | ImprovedTerseObjectUpdatePacket packet | ||
4039 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
4040 | PacketType.ImprovedTerseObjectUpdate); | ||
4041 | 4036 | ||
4042 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4037 | if (objectUpdateBlocks.IsValueCreated) |
4043 | packet.RegionData.TimeDilation = timeDilation; | 4038 | { |
4044 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 4039 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; |
4045 | 4040 | ||
4046 | for (int i = 0; i < blocks.Count; i++) | 4041 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
4047 | packet.ObjectData[i] = blocks[i]; | 4042 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
4048 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | 4043 | packet.RegionData.TimeDilation = timeDilation; |
4049 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | 4044 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; |
4050 | } | 4045 | |
4046 | for (int i = 0; i < blocks.Count; i++) | ||
4047 | packet.ObjectData[i] = blocks[i]; | ||
4048 | |||
4049 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4050 | } | ||
4051 | |||
4052 | if (compressedUpdateBlocks.IsValueCreated) | ||
4053 | { | ||
4054 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
4055 | |||
4056 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
4057 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4058 | packet.RegionData.TimeDilation = timeDilation; | ||
4059 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
4060 | |||
4061 | for (int i = 0; i < blocks.Count; i++) | ||
4062 | packet.ObjectData[i] = blocks[i]; | ||
4063 | |||
4064 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4065 | } | ||
4066 | |||
4067 | if (terseUpdateBlocks.IsValueCreated) | ||
4068 | { | ||
4069 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
4070 | |||
4071 | ImprovedTerseObjectUpdatePacket packet | ||
4072 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
4073 | PacketType.ImprovedTerseObjectUpdate); | ||
4074 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4075 | packet.RegionData.TimeDilation = timeDilation; | ||
4076 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4077 | |||
4078 | for (int i = 0; i < blocks.Count; i++) | ||
4079 | packet.ObjectData[i] = blocks[i]; | ||
4080 | |||
4081 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | ||
4051 | } | 4082 | } |
4052 | 4083 | ||
4053 | #endregion Packet Sending | 4084 | #endregion Packet Sending |
@@ -4340,11 +4371,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4340 | 4371 | ||
4341 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties | 4372 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties |
4342 | // of the object rather than the properties when the packet was created | 4373 | // of the object rather than the properties when the packet was created |
4343 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4374 | // HACK : Remove intelligent resending until it's fixed in core |
4344 | delegate(OutgoingPacket oPacket) | 4375 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4345 | { | 4376 | // delegate(OutgoingPacket oPacket) |
4346 | ResendPropertyUpdates(updates, oPacket); | 4377 | // { |
4347 | }); | 4378 | // ResendPropertyUpdates(updates, oPacket); |
4379 | // }); | ||
4380 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4348 | 4381 | ||
4349 | // pbcnt += blocks.Count; | 4382 | // pbcnt += blocks.Count; |
4350 | // ppcnt++; | 4383 | // ppcnt++; |
@@ -4370,11 +4403,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4370 | // of the object rather than the properties when the packet was created | 4403 | // of the object rather than the properties when the packet was created |
4371 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); | 4404 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); |
4372 | updates.Add(familyUpdates.Value[i]); | 4405 | updates.Add(familyUpdates.Value[i]); |
4373 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4406 | // HACK : Remove intelligent resending until it's fixed in core |
4374 | delegate(OutgoingPacket oPacket) | 4407 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4375 | { | 4408 | // delegate(OutgoingPacket oPacket) |
4376 | ResendPropertyUpdates(updates, oPacket); | 4409 | // { |
4377 | }); | 4410 | // ResendPropertyUpdates(updates, oPacket); |
4411 | // }); | ||
4412 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4378 | 4413 | ||
4379 | // fpcnt++; | 4414 | // fpcnt++; |
4380 | // fbcnt++; | 4415 | // fbcnt++; |
@@ -4746,7 +4781,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4746 | 4781 | ||
4747 | if (landData.SimwideArea > 0) | 4782 | if (landData.SimwideArea > 0) |
4748 | { | 4783 | { |
4749 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 4784 | int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L); |
4785 | // Never report more than sim total capacity | ||
4786 | if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity) | ||
4787 | simulatorCapacity = m_scene.RegionInfo.ObjectCapacity; | ||
4750 | updateMessage.SimWideMaxPrims = simulatorCapacity; | 4788 | updateMessage.SimWideMaxPrims = simulatorCapacity; |
4751 | } | 4789 | } |
4752 | else | 4790 | else |
@@ -4875,14 +4913,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4875 | 4913 | ||
4876 | if (notifyCount > 0) | 4914 | if (notifyCount > 0) |
4877 | { | 4915 | { |
4878 | if (notifyCount > 32) | 4916 | // if (notifyCount > 32) |
4879 | { | 4917 | // { |
4880 | m_log.InfoFormat( | 4918 | // m_log.InfoFormat( |
4881 | "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" | 4919 | // "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" |
4882 | + " - a developer might want to investigate whether this is a hard limit", 32); | 4920 | // + " - a developer might want to investigate whether this is a hard limit", 32); |
4883 | 4921 | // | |
4884 | notifyCount = 32; | 4922 | // notifyCount = 32; |
4885 | } | 4923 | // } |
4886 | 4924 | ||
4887 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock | 4925 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock |
4888 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; | 4926 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; |
@@ -4937,9 +4975,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4937 | { | 4975 | { |
4938 | ScenePresence presence = (ScenePresence)entity; | 4976 | ScenePresence presence = (ScenePresence)entity; |
4939 | 4977 | ||
4978 | position = presence.OffsetPosition; | ||
4979 | rotation = presence.Rotation; | ||
4980 | |||
4981 | if (presence.ParentID != 0) | ||
4982 | { | ||
4983 | SceneObjectPart part = m_scene.GetSceneObjectPart(presence.ParentID); | ||
4984 | if (part != null && part != part.ParentGroup.RootPart) | ||
4985 | { | ||
4986 | position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; | ||
4987 | rotation = part.RotationOffset * presence.Rotation; | ||
4988 | } | ||
4989 | angularVelocity = Vector3.Zero; | ||
4990 | } | ||
4991 | else | ||
4992 | { | ||
4993 | angularVelocity = presence.AngularVelocity; | ||
4994 | rotation = presence.Rotation; | ||
4995 | } | ||
4996 | |||
4940 | attachPoint = 0; | 4997 | attachPoint = 0; |
4941 | collisionPlane = presence.CollisionPlane; | 4998 | collisionPlane = presence.CollisionPlane; |
4942 | position = presence.OffsetPosition; | ||
4943 | velocity = presence.Velocity; | 4999 | velocity = presence.Velocity; |
4944 | acceleration = Vector3.Zero; | 5000 | acceleration = Vector3.Zero; |
4945 | 5001 | ||
@@ -4948,9 +5004,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4948 | // may improve movement smoothness. | 5004 | // may improve movement smoothness. |
4949 | // acceleration = new Vector3(1, 0, 0); | 5005 | // acceleration = new Vector3(1, 0, 0); |
4950 | 5006 | ||
4951 | angularVelocity = presence.AngularVelocity; | ||
4952 | rotation = presence.Rotation; | ||
4953 | |||
4954 | if (sendTexture) | 5007 | if (sendTexture) |
4955 | textureEntry = presence.Appearance.Texture.GetBytes(); | 5008 | textureEntry = presence.Appearance.Texture.GetBytes(); |
4956 | else | 5009 | else |
@@ -5056,13 +5109,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5056 | 5109 | ||
5057 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) | 5110 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) |
5058 | { | 5111 | { |
5112 | Vector3 offsetPosition = data.OffsetPosition; | ||
5113 | Quaternion rotation = data.Rotation; | ||
5114 | uint parentID = data.ParentID; | ||
5115 | |||
5116 | if (parentID != 0) | ||
5117 | { | ||
5118 | SceneObjectPart part = m_scene.GetSceneObjectPart(parentID); | ||
5119 | if (part != null && part != part.ParentGroup.RootPart) | ||
5120 | { | ||
5121 | offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset; | ||
5122 | rotation = part.RotationOffset * data.Rotation; | ||
5123 | parentID = part.ParentGroup.RootPart.LocalId; | ||
5124 | } | ||
5125 | } | ||
5126 | |||
5059 | byte[] objectData = new byte[76]; | 5127 | byte[] objectData = new byte[76]; |
5060 | 5128 | ||
5061 | data.CollisionPlane.ToBytes(objectData, 0); | 5129 | data.CollisionPlane.ToBytes(objectData, 0); |
5062 | data.OffsetPosition.ToBytes(objectData, 16); | 5130 | offsetPosition.ToBytes(objectData, 16); |
5063 | // data.Velocity.ToBytes(objectData, 28); | 5131 | // data.Velocity.ToBytes(objectData, 28); |
5064 | // data.Acceleration.ToBytes(objectData, 40); | 5132 | // data.Acceleration.ToBytes(objectData, 40); |
5065 | data.Rotation.ToBytes(objectData, 52); | 5133 | rotation.ToBytes(objectData, 52); |
5066 | //data.AngularVelocity.ToBytes(objectData, 64); | 5134 | //data.AngularVelocity.ToBytes(objectData, 64); |
5067 | 5135 | ||
5068 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | 5136 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); |
@@ -5076,14 +5144,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5076 | update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + | 5144 | update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + |
5077 | data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); | 5145 | data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); |
5078 | update.ObjectData = objectData; | 5146 | update.ObjectData = objectData; |
5079 | update.ParentID = data.ParentID; | 5147 | update.ParentID = parentID; |
5080 | update.PathCurve = 16; | 5148 | update.PathCurve = 16; |
5081 | update.PathScaleX = 100; | 5149 | update.PathScaleX = 100; |
5082 | update.PathScaleY = 100; | 5150 | update.PathScaleY = 100; |
5083 | update.PCode = (byte)PCode.Avatar; | 5151 | update.PCode = (byte)PCode.Avatar; |
5084 | update.ProfileCurve = 1; | 5152 | update.ProfileCurve = 1; |
5085 | update.PSBlock = Utils.EmptyBytes; | 5153 | update.PSBlock = Utils.EmptyBytes; |
5086 | update.Scale = new Vector3(0.45f, 0.6f, 1.9f); | 5154 | update.Scale = data.Appearance.AvatarSize; |
5155 | // update.Scale.Z -= 0.2f; | ||
5156 | |||
5087 | update.Text = Utils.EmptyBytes; | 5157 | update.Text = Utils.EmptyBytes; |
5088 | update.TextColor = new byte[4]; | 5158 | update.TextColor = new byte[4]; |
5089 | 5159 | ||
@@ -5094,10 +5164,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5094 | update.TextureEntry = Utils.EmptyBytes; | 5164 | update.TextureEntry = Utils.EmptyBytes; |
5095 | // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; | 5165 | // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; |
5096 | 5166 | ||
5167 | /* all this flags seem related to prims and not avatars. This allow for wrong viewer side move of a avatar in prim edition mode (anv mantis 854) | ||
5097 | update.UpdateFlags = (uint)( | 5168 | update.UpdateFlags = (uint)( |
5098 | PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | | 5169 | PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | |
5099 | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | | 5170 | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | |
5100 | PrimFlags.ObjectOwnerModify); | 5171 | PrimFlags.ObjectOwnerModify); |
5172 | */ | ||
5173 | update.UpdateFlags = 0; | ||
5101 | 5174 | ||
5102 | return update; | 5175 | return update; |
5103 | } | 5176 | } |
@@ -5268,8 +5341,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5268 | // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs | 5341 | // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs |
5269 | // for each AgentUpdate packet. | 5342 | // for each AgentUpdate packet. |
5270 | AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); | 5343 | AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); |
5271 | 5344 | ||
5272 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); | 5345 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); |
5346 | AddLocalPacketHandler(PacketType.VelocityInterpolateOff, HandleVelocityInterpolateOff, false); | ||
5347 | AddLocalPacketHandler(PacketType.VelocityInterpolateOn, HandleVelocityInterpolateOn, false); | ||
5273 | AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); | 5348 | AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); |
5274 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); | 5349 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); |
5275 | AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); | 5350 | AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); |
@@ -5421,6 +5496,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5421 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); | 5496 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); |
5422 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); | 5497 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); |
5423 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); | 5498 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); |
5499 | AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments); | ||
5424 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); | 5500 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); |
5425 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); | 5501 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); |
5426 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); | 5502 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); |
@@ -5487,6 +5563,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5487 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); | 5563 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); |
5488 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); | 5564 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); |
5489 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); | 5565 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); |
5566 | AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags); | ||
5490 | 5567 | ||
5491 | AddGenericPacketHandler("autopilot", HandleAutopilot); | 5568 | AddGenericPacketHandler("autopilot", HandleAutopilot); |
5492 | } | 5569 | } |
@@ -5525,6 +5602,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5525 | (x.CameraLeftAxis != m_lastAgentUpdateArgs.CameraLeftAxis) || | 5602 | (x.CameraLeftAxis != m_lastAgentUpdateArgs.CameraLeftAxis) || |
5526 | (x.CameraUpAxis != m_lastAgentUpdateArgs.CameraUpAxis) || | 5603 | (x.CameraUpAxis != m_lastAgentUpdateArgs.CameraUpAxis) || |
5527 | (x.ControlFlags != m_lastAgentUpdateArgs.ControlFlags) || | 5604 | (x.ControlFlags != m_lastAgentUpdateArgs.ControlFlags) || |
5605 | (x.ControlFlags != 0) || | ||
5528 | (x.Far != m_lastAgentUpdateArgs.Far) || | 5606 | (x.Far != m_lastAgentUpdateArgs.Far) || |
5529 | (x.Flags != m_lastAgentUpdateArgs.Flags) || | 5607 | (x.Flags != m_lastAgentUpdateArgs.Flags) || |
5530 | (x.State != m_lastAgentUpdateArgs.State) || | 5608 | (x.State != m_lastAgentUpdateArgs.State) || |
@@ -5784,6 +5862,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5784 | return true; | 5862 | return true; |
5785 | } | 5863 | } |
5786 | 5864 | ||
5865 | private bool HandleVelocityInterpolateOff(IClientAPI sender, Packet Pack) | ||
5866 | { | ||
5867 | VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack; | ||
5868 | if (p.AgentData.SessionID != SessionId || | ||
5869 | p.AgentData.AgentID != AgentId) | ||
5870 | return true; | ||
5871 | |||
5872 | m_VelocityInterpolate = false; | ||
5873 | return true; | ||
5874 | } | ||
5875 | |||
5876 | private bool HandleVelocityInterpolateOn(IClientAPI sender, Packet Pack) | ||
5877 | { | ||
5878 | VelocityInterpolateOnPacket p = (VelocityInterpolateOnPacket)Pack; | ||
5879 | if (p.AgentData.SessionID != SessionId || | ||
5880 | p.AgentData.AgentID != AgentId) | ||
5881 | return true; | ||
5882 | |||
5883 | m_VelocityInterpolate = true; | ||
5884 | return true; | ||
5885 | } | ||
5886 | |||
5887 | |||
5787 | private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) | 5888 | private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) |
5788 | { | 5889 | { |
5789 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; | 5890 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; |
@@ -6204,17 +6305,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6204 | // Temporarily protect ourselves from the mantis #951 failure. | 6305 | // Temporarily protect ourselves from the mantis #951 failure. |
6205 | // However, we could do this for several other handlers where a failure isn't terminal | 6306 | // However, we could do this for several other handlers where a failure isn't terminal |
6206 | // for the client session anyway, in order to protect ourselves against bad code in plugins | 6307 | // for the client session anyway, in order to protect ourselves against bad code in plugins |
6308 | Vector3 avSize = appear.AgentData.Size; | ||
6207 | try | 6309 | try |
6208 | { | 6310 | { |
6209 | byte[] visualparams = new byte[appear.VisualParam.Length]; | 6311 | byte[] visualparams = new byte[appear.VisualParam.Length]; |
6210 | for (int i = 0; i < appear.VisualParam.Length; i++) | 6312 | for (int i = 0; i < appear.VisualParam.Length; i++) |
6211 | visualparams[i] = appear.VisualParam[i].ParamValue; | 6313 | visualparams[i] = appear.VisualParam[i].ParamValue; |
6212 | 6314 | //var b = appear.WearableData[0]; | |
6315 | |||
6213 | Primitive.TextureEntry te = null; | 6316 | Primitive.TextureEntry te = null; |
6214 | if (appear.ObjectData.TextureEntry.Length > 1) | 6317 | if (appear.ObjectData.TextureEntry.Length > 1) |
6215 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); | 6318 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); |
6319 | |||
6320 | WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; | ||
6321 | for (int i=0; i<appear.WearableData.Length;i++) | ||
6322 | cacheitems[i] = new WearableCacheItem(){CacheId = appear.WearableData[i].CacheID,TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)}; | ||
6216 | 6323 | ||
6217 | handlerSetAppearance(sender, te, visualparams); | 6324 | |
6325 | |||
6326 | handlerSetAppearance(sender, te, visualparams,avSize, cacheitems); | ||
6218 | } | 6327 | } |
6219 | catch (Exception e) | 6328 | catch (Exception e) |
6220 | { | 6329 | { |
@@ -6423,6 +6532,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6423 | { | 6532 | { |
6424 | handlerCompleteMovementToRegion(sender, true); | 6533 | handlerCompleteMovementToRegion(sender, true); |
6425 | } | 6534 | } |
6535 | else | ||
6536 | m_log.Debug("HandleCompleteAgentMovement NULL handler"); | ||
6537 | |||
6426 | handlerCompleteMovementToRegion = null; | 6538 | handlerCompleteMovementToRegion = null; |
6427 | 6539 | ||
6428 | return true; | 6540 | return true; |
@@ -6440,7 +6552,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6440 | return true; | 6552 | return true; |
6441 | } | 6553 | } |
6442 | #endregion | 6554 | #endregion |
6443 | 6555 | /* | |
6444 | StartAnim handlerStartAnim = null; | 6556 | StartAnim handlerStartAnim = null; |
6445 | StopAnim handlerStopAnim = null; | 6557 | StopAnim handlerStopAnim = null; |
6446 | 6558 | ||
@@ -6464,6 +6576,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6464 | } | 6576 | } |
6465 | } | 6577 | } |
6466 | return true; | 6578 | return true; |
6579 | */ | ||
6580 | ChangeAnim handlerChangeAnim = null; | ||
6581 | |||
6582 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | ||
6583 | { | ||
6584 | handlerChangeAnim = OnChangeAnim; | ||
6585 | if (handlerChangeAnim != null) | ||
6586 | { | ||
6587 | handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false); | ||
6588 | } | ||
6589 | } | ||
6590 | |||
6591 | handlerChangeAnim = OnChangeAnim; | ||
6592 | if (handlerChangeAnim != null) | ||
6593 | { | ||
6594 | handlerChangeAnim(UUID.Zero, false, true); | ||
6595 | } | ||
6596 | |||
6597 | return true; | ||
6467 | } | 6598 | } |
6468 | 6599 | ||
6469 | private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) | 6600 | private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) |
@@ -6689,6 +6820,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6689 | #endregion | 6820 | #endregion |
6690 | 6821 | ||
6691 | m_udpClient.SetThrottles(atpack.Throttle.Throttles); | 6822 | m_udpClient.SetThrottles(atpack.Throttle.Throttles); |
6823 | GenericCall2 handler = OnUpdateThrottles; | ||
6824 | if (handler != null) | ||
6825 | { | ||
6826 | handler(); | ||
6827 | } | ||
6692 | return true; | 6828 | return true; |
6693 | } | 6829 | } |
6694 | 6830 | ||
@@ -7113,7 +7249,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7113 | physdata.Bounce = phsblock.Restitution; | 7249 | physdata.Bounce = phsblock.Restitution; |
7114 | physdata.Density = phsblock.Density; | 7250 | physdata.Density = phsblock.Density; |
7115 | physdata.Friction = phsblock.Friction; | 7251 | physdata.Friction = phsblock.Friction; |
7116 | physdata.GravitationModifier = phsblock.GravityMultiplier; | 7252 | physdata.GravitationModifier = phsblock.GravityMultiplier; |
7117 | } | 7253 | } |
7118 | 7254 | ||
7119 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); | 7255 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); |
@@ -7699,6 +7835,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7699 | // surrounding scene | 7835 | // surrounding scene |
7700 | if ((ImageType)block.Type == ImageType.Baked) | 7836 | if ((ImageType)block.Type == ImageType.Baked) |
7701 | args.Priority *= 2.0f; | 7837 | args.Priority *= 2.0f; |
7838 | int wearableout = 0; | ||
7702 | 7839 | ||
7703 | ImageManager.EnqueueReq(args); | 7840 | ImageManager.EnqueueReq(args); |
7704 | } | 7841 | } |
@@ -8717,16 +8854,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8717 | 8854 | ||
8718 | #region Parcel related packets | 8855 | #region Parcel related packets |
8719 | 8856 | ||
8857 | // acumulate several HandleRegionHandleRequest consecutive overlaping requests | ||
8858 | // to be done with minimal resources as possible | ||
8859 | // variables temporary here while in test | ||
8860 | |||
8861 | Queue<UUID> RegionHandleRequests = new Queue<UUID>(); | ||
8862 | bool RegionHandleRequestsInService = false; | ||
8863 | |||
8720 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) | 8864 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) |
8721 | { | 8865 | { |
8722 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | 8866 | UUID currentUUID; |
8723 | 8867 | ||
8724 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; | 8868 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; |
8725 | if (handlerRegionHandleRequest != null) | 8869 | |
8870 | if (handlerRegionHandleRequest == null) | ||
8871 | return true; | ||
8872 | |||
8873 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | ||
8874 | |||
8875 | lock (RegionHandleRequests) | ||
8876 | { | ||
8877 | if (RegionHandleRequestsInService) | ||
8878 | { | ||
8879 | // we are already busy doing a previus request | ||
8880 | // so enqueue it | ||
8881 | RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID); | ||
8882 | return true; | ||
8883 | } | ||
8884 | |||
8885 | // else do it | ||
8886 | currentUUID = rhrPack.RequestBlock.RegionID; | ||
8887 | RegionHandleRequestsInService = true; | ||
8888 | } | ||
8889 | |||
8890 | while (true) | ||
8726 | { | 8891 | { |
8727 | handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); | 8892 | handlerRegionHandleRequest(this, currentUUID); |
8893 | |||
8894 | lock (RegionHandleRequests) | ||
8895 | { | ||
8896 | // exit condition, nothing to do or closed | ||
8897 | // current code seems to assume we may loose the handler at anytime, | ||
8898 | // so keep checking it | ||
8899 | handlerRegionHandleRequest = OnRegionHandleRequest; | ||
8900 | |||
8901 | if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null) | ||
8902 | { | ||
8903 | RegionHandleRequests.Clear(); | ||
8904 | RegionHandleRequestsInService = false; | ||
8905 | return true; | ||
8906 | } | ||
8907 | currentUUID = RegionHandleRequests.Dequeue(); | ||
8908 | } | ||
8728 | } | 8909 | } |
8729 | return true; | 8910 | |
8911 | return true; // actually unreached | ||
8730 | } | 8912 | } |
8731 | 8913 | ||
8732 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) | 8914 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) |
@@ -9982,7 +10164,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9982 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, | 10164 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, |
9983 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), | 10165 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), |
9984 | UpdateMuteListEntry.MuteData.MuteType, | 10166 | UpdateMuteListEntry.MuteData.MuteType, |
9985 | UpdateMuteListEntry.AgentData.AgentID); | 10167 | UpdateMuteListEntry.MuteData.MuteFlags); |
9986 | return true; | 10168 | return true; |
9987 | } | 10169 | } |
9988 | return false; | 10170 | return false; |
@@ -9997,8 +10179,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9997 | { | 10179 | { |
9998 | handlerRemoveMuteListEntry(this, | 10180 | handlerRemoveMuteListEntry(this, |
9999 | RemoveMuteListEntry.MuteData.MuteID, | 10181 | RemoveMuteListEntry.MuteData.MuteID, |
10000 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), | 10182 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName)); |
10001 | RemoveMuteListEntry.AgentData.AgentID); | ||
10002 | return true; | 10183 | return true; |
10003 | } | 10184 | } |
10004 | return false; | 10185 | return false; |
@@ -10042,10 +10223,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10042 | return false; | 10223 | return false; |
10043 | } | 10224 | } |
10044 | 10225 | ||
10226 | private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet) | ||
10227 | { | ||
10228 | ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags = | ||
10229 | (ChangeInventoryItemFlagsPacket)packet; | ||
10230 | ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags; | ||
10231 | if (handlerChangeInventoryItemFlags != null) | ||
10232 | { | ||
10233 | foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData) | ||
10234 | handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags); | ||
10235 | return true; | ||
10236 | } | ||
10237 | return false; | ||
10238 | } | ||
10239 | |||
10045 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) | 10240 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) |
10046 | { | 10241 | { |
10047 | return true; | 10242 | return true; |
10048 | } | 10243 | } |
10244 | |||
10245 | private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack) | ||
10246 | { | ||
10247 | CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack; | ||
10248 | |||
10249 | #region Packet Session and User Check | ||
10250 | if (m_checkPackets) | ||
10251 | { | ||
10252 | if (packet.AgentData.SessionID != SessionId || | ||
10253 | packet.AgentData.AgentID != AgentId) | ||
10254 | return true; | ||
10255 | } | ||
10256 | #endregion | ||
10257 | MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null; | ||
10258 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
10259 | foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData) | ||
10260 | { | ||
10261 | InventoryItemBase b = new InventoryItemBase(); | ||
10262 | b.ID = n.OldItemID; | ||
10263 | b.Folder = n.OldFolderID; | ||
10264 | items.Add(b); | ||
10265 | } | ||
10266 | |||
10267 | handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy; | ||
10268 | if (handlerMoveItemsAndLeaveCopy != null) | ||
10269 | { | ||
10270 | handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID); | ||
10271 | } | ||
10272 | |||
10273 | return true; | ||
10274 | } | ||
10049 | 10275 | ||
10050 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) | 10276 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) |
10051 | { | 10277 | { |
@@ -10472,6 +10698,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10472 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; | 10698 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; |
10473 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; | 10699 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; |
10474 | 10700 | ||
10701 | Scene scene = (Scene)m_scene; | ||
10702 | if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID))) | ||
10703 | { | ||
10704 | ScenePresence p; | ||
10705 | if (scene.TryGetScenePresence(sender.AgentId, out p)) | ||
10706 | { | ||
10707 | if (p.GodLevel >= 200) | ||
10708 | { | ||
10709 | groupProfileReply.GroupData.OpenEnrollment = true; | ||
10710 | groupProfileReply.GroupData.MembershipFee = 0; | ||
10711 | } | ||
10712 | } | ||
10713 | } | ||
10714 | |||
10475 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); | 10715 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); |
10476 | } | 10716 | } |
10477 | return true; | 10717 | return true; |
@@ -11045,11 +11285,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11045 | 11285 | ||
11046 | StartLure handlerStartLure = OnStartLure; | 11286 | StartLure handlerStartLure = OnStartLure; |
11047 | if (handlerStartLure != null) | 11287 | if (handlerStartLure != null) |
11048 | handlerStartLure(startLureRequest.Info.LureType, | 11288 | { |
11049 | Utils.BytesToString( | 11289 | for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++) |
11050 | startLureRequest.Info.Message), | 11290 | { |
11051 | startLureRequest.TargetData[0].TargetID, | 11291 | handlerStartLure(startLureRequest.Info.LureType, |
11052 | this); | 11292 | Utils.BytesToString( |
11293 | startLureRequest.Info.Message), | ||
11294 | startLureRequest.TargetData[i].TargetID, | ||
11295 | this); | ||
11296 | } | ||
11297 | } | ||
11053 | return true; | 11298 | return true; |
11054 | } | 11299 | } |
11055 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) | 11300 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) |
@@ -11163,10 +11408,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11163 | } | 11408 | } |
11164 | #endregion | 11409 | #endregion |
11165 | 11410 | ||
11166 | ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; | 11411 | ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; |
11167 | if (handlerClassifiedGodDelete != null) | 11412 | if (handlerClassifiedGodDelete != null) |
11168 | handlerClassifiedGodDelete( | 11413 | handlerClassifiedGodDelete( |
11169 | classifiedGodDelete.Data.ClassifiedID, | 11414 | classifiedGodDelete.Data.ClassifiedID, |
11415 | classifiedGodDelete.Data.QueryID, | ||
11170 | this); | 11416 | this); |
11171 | return true; | 11417 | return true; |
11172 | } | 11418 | } |
@@ -11469,12 +11715,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11469 | /// <param name="simclient"></param> | 11715 | /// <param name="simclient"></param> |
11470 | /// <param name="packet"></param> | 11716 | /// <param name="packet"></param> |
11471 | /// <returns></returns> | 11717 | /// <returns></returns> |
11472 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) | 11718 | // TODO: Convert old handler to use new method |
11719 | /*protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) | ||
11473 | { | 11720 | { |
11474 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; | 11721 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; |
11475 | 11722 | ||
11476 | if (cachedtex.AgentData.SessionID != SessionId) | 11723 | if (cachedtex.AgentData.SessionID != SessionId) |
11477 | return false; | 11724 | return false; |
11725 | |||
11478 | 11726 | ||
11479 | List<CachedTextureRequestArg> requestArgs = new List<CachedTextureRequestArg>(); | 11727 | List<CachedTextureRequestArg> requestArgs = new List<CachedTextureRequestArg>(); |
11480 | 11728 | ||
@@ -11494,8 +11742,166 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11494 | } | 11742 | } |
11495 | 11743 | ||
11496 | return true; | 11744 | return true; |
11745 | }*/ | ||
11746 | |||
11747 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) | ||
11748 | { | ||
11749 | //m_log.Debug("texture cached: " + packet.ToString()); | ||
11750 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; | ||
11751 | AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); | ||
11752 | |||
11753 | if (cachedtex.AgentData.SessionID != SessionId) | ||
11754 | return false; | ||
11755 | |||
11756 | |||
11757 | // TODO: don't create new blocks if recycling an old packet | ||
11758 | cachedresp.AgentData.AgentID = AgentId; | ||
11759 | cachedresp.AgentData.SessionID = m_sessionId; | ||
11760 | cachedresp.AgentData.SerialNum = m_cachedTextureSerial; | ||
11761 | m_cachedTextureSerial++; | ||
11762 | cachedresp.WearableData = | ||
11763 | new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; | ||
11764 | |||
11765 | //IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>(); | ||
11766 | // var item = fac.GetBakedTextureFaces(AgentId); | ||
11767 | //WearableCacheItem[] items = fac.GetCachedItems(AgentId); | ||
11768 | |||
11769 | IAssetService cache = m_scene.AssetService; | ||
11770 | IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | ||
11771 | //bakedTextureModule = null; | ||
11772 | int maxWearablesLoop = cachedtex.WearableData.Length; | ||
11773 | if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) | ||
11774 | maxWearablesLoop = AvatarWearable.MAX_WEARABLES; | ||
11775 | |||
11776 | if (bakedTextureModule != null && cache != null) | ||
11777 | { | ||
11778 | // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid | ||
11779 | |||
11780 | WearableCacheItem[] cacheItems = null; | ||
11781 | ScenePresence p = m_scene.GetScenePresence(AgentId); | ||
11782 | if (p.Appearance != null) | ||
11783 | if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) | ||
11784 | { | ||
11785 | try | ||
11786 | { | ||
11787 | cacheItems = bakedTextureModule.Get(AgentId); | ||
11788 | p.Appearance.WearableCacheItems = cacheItems; | ||
11789 | p.Appearance.WearableCacheItemsDirty = false; | ||
11790 | } | ||
11791 | |||
11792 | /* | ||
11793 | * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! | ||
11794 | * | ||
11795 | catch (System.Net.Sockets.SocketException) | ||
11796 | { | ||
11797 | cacheItems = null; | ||
11798 | } | ||
11799 | catch (WebException) | ||
11800 | { | ||
11801 | cacheItems = null; | ||
11802 | } | ||
11803 | catch (InvalidOperationException) | ||
11804 | { | ||
11805 | cacheItems = null; | ||
11806 | } */ | ||
11807 | catch (Exception) | ||
11808 | { | ||
11809 | cacheItems = null; | ||
11810 | } | ||
11811 | |||
11812 | } | ||
11813 | else if (p.Appearance.WearableCacheItems != null) | ||
11814 | { | ||
11815 | cacheItems = p.Appearance.WearableCacheItems; | ||
11816 | } | ||
11817 | |||
11818 | if (cache != null && cacheItems != null) | ||
11819 | { | ||
11820 | foreach (WearableCacheItem item in cacheItems) | ||
11821 | { | ||
11822 | |||
11823 | if (cache.GetCached(item.TextureID.ToString()) == null) | ||
11824 | { | ||
11825 | item.TextureAsset.Temporary = true; | ||
11826 | cache.Store(item.TextureAsset); | ||
11827 | } | ||
11828 | |||
11829 | |||
11830 | } | ||
11831 | } | ||
11832 | |||
11833 | if (cacheItems != null) | ||
11834 | { | ||
11835 | |||
11836 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11837 | { | ||
11838 | WearableCacheItem item = | ||
11839 | WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems); | ||
11840 | |||
11841 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11842 | cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; | ||
11843 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11844 | if (item != null && cachedtex.WearableData[i].ID == item.CacheId) | ||
11845 | { | ||
11846 | |||
11847 | cachedresp.WearableData[i].TextureID = item.TextureID; | ||
11848 | } | ||
11849 | else | ||
11850 | { | ||
11851 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11852 | } | ||
11853 | } | ||
11854 | } | ||
11855 | else | ||
11856 | { | ||
11857 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11858 | { | ||
11859 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11860 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11861 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11862 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11863 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11864 | } | ||
11865 | } | ||
11866 | } | ||
11867 | else | ||
11868 | { | ||
11869 | if (cache == null) | ||
11870 | { | ||
11871 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11872 | { | ||
11873 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11874 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11875 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11876 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11877 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11878 | } | ||
11879 | } | ||
11880 | else | ||
11881 | { | ||
11882 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11883 | { | ||
11884 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11885 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11886 | |||
11887 | |||
11888 | |||
11889 | if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null) | ||
11890 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11891 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11892 | else | ||
11893 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11894 | // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11895 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11896 | } | ||
11897 | } | ||
11898 | } | ||
11899 | cachedresp.Header.Zerocoded = true; | ||
11900 | OutPacket(cachedresp, ThrottleOutPacketType.Task); | ||
11901 | |||
11902 | return true; | ||
11497 | } | 11903 | } |
11498 | 11904 | ||
11499 | /// <summary> | 11905 | /// <summary> |
11500 | /// Send a response back to a client when it asks the asset server (via the region server) if it has | 11906 | /// Send a response back to a client when it asks the asset server (via the region server) if it has |
11501 | /// its appearance texture cached. | 11907 | /// its appearance texture cached. |
@@ -11559,209 +11965,147 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11559 | } | 11965 | } |
11560 | else | 11966 | else |
11561 | { | 11967 | { |
11562 | // m_log.DebugFormat( | 11968 | ClientChangeObject updatehandler = onClientChangeObject; |
11563 | // "[CLIENT]: Processing block {0} type {1} for {2} {3}", | ||
11564 | // i, block.Type, part.Name, part.LocalId); | ||
11565 | 11969 | ||
11566 | // // Do this once since fetch parts creates a new array. | 11970 | if (updatehandler != null) |
11567 | // SceneObjectPart[] parts = part.ParentGroup.Parts; | 11971 | { |
11568 | // for (int j = 0; j < parts.Length; j++) | 11972 | ObjectChangeData udata = new ObjectChangeData(); |
11569 | // { | ||
11570 | // part.StoreUndoState(); | ||
11571 | // parts[j].IgnoreUndoUpdate = true; | ||
11572 | // } | ||
11573 | 11973 | ||
11574 | UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; | 11974 | /*ubit from ll JIRA: |
11975 | * 0x01 position | ||
11976 | * 0x02 rotation | ||
11977 | * 0x04 scale | ||
11978 | |||
11979 | * 0x08 LINK_SET | ||
11980 | * 0x10 UNIFORM for scale | ||
11981 | */ | ||
11575 | 11982 | ||
11576 | switch (block.Type) | 11983 | // translate to internal changes |
11577 | { | 11984 | // not all cases .. just the ones older code did |
11578 | case 1: | ||
11579 | Vector3 pos1 = new Vector3(block.Data, 0); | ||
11580 | 11985 | ||
11581 | UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11986 | switch (block.Type) |
11582 | if (handlerUpdatePrimSinglePosition != null) | 11987 | { |
11583 | { | 11988 | case 1: //change position sp |
11584 | // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 11989 | udata.position = new Vector3(block.Data, 0); |
11585 | handlerUpdatePrimSinglePosition(localId, pos1, this); | ||
11586 | } | ||
11587 | break; | ||
11588 | 11990 | ||
11589 | case 2: | 11991 | udata.change = ObjectChangeType.primP; |
11590 | Quaternion rot1 = new Quaternion(block.Data, 0, true); | 11992 | updatehandler(localId, udata, this); |
11993 | break; | ||
11591 | 11994 | ||
11592 | UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; | 11995 | case 2: // rotation sp |
11593 | if (handlerUpdatePrimSingleRotation != null) | 11996 | udata.rotation = new Quaternion(block.Data, 0, true); |
11594 | { | ||
11595 | // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W); | ||
11596 | handlerUpdatePrimSingleRotation(localId, rot1, this); | ||
11597 | } | ||
11598 | break; | ||
11599 | 11997 | ||
11600 | case 3: | 11998 | udata.change = ObjectChangeType.primR; |
11601 | Vector3 rotPos = new Vector3(block.Data, 0); | 11999 | updatehandler(localId, udata, this); |
11602 | Quaternion rot2 = new Quaternion(block.Data, 12, true); | 12000 | break; |
11603 | 12001 | ||
11604 | UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; | 12002 | case 3: // position plus rotation |
11605 | if (handlerUpdatePrimSingleRotationPosition != null) | 12003 | udata.position = new Vector3(block.Data, 0); |
11606 | { | 12004 | udata.rotation = new Quaternion(block.Data, 12, true); |
11607 | // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z); | ||
11608 | // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W); | ||
11609 | handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this); | ||
11610 | } | ||
11611 | break; | ||
11612 | 12005 | ||
11613 | case 4: | 12006 | udata.change = ObjectChangeType.primPR; |
11614 | case 20: | 12007 | updatehandler(localId, udata, this); |
11615 | Vector3 scale4 = new Vector3(block.Data, 0); | 12008 | break; |
11616 | 12009 | ||
11617 | UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; | 12010 | case 4: // scale sp |
11618 | if (handlerUpdatePrimScale != null) | 12011 | udata.scale = new Vector3(block.Data, 0); |
11619 | { | 12012 | udata.change = ObjectChangeType.primS; |
11620 | // m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z); | ||
11621 | handlerUpdatePrimScale(localId, scale4, this); | ||
11622 | } | ||
11623 | break; | ||
11624 | 12013 | ||
11625 | case 5: | 12014 | updatehandler(localId, udata, this); |
11626 | Vector3 scale1 = new Vector3(block.Data, 12); | 12015 | break; |
11627 | Vector3 pos11 = new Vector3(block.Data, 0); | ||
11628 | 12016 | ||
11629 | handlerUpdatePrimScale = OnUpdatePrimScale; | 12017 | case 0x14: // uniform scale sp |
11630 | if (handlerUpdatePrimScale != null) | 12018 | udata.scale = new Vector3(block.Data, 0); |
11631 | { | ||
11632 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11633 | handlerUpdatePrimScale(localId, scale1, this); | ||
11634 | 12019 | ||
11635 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 12020 | udata.change = ObjectChangeType.primUS; |
11636 | if (handlerUpdatePrimSinglePosition != null) | 12021 | updatehandler(localId, udata, this); |
11637 | { | 12022 | break; |
11638 | handlerUpdatePrimSinglePosition(localId, pos11, this); | ||
11639 | } | ||
11640 | } | ||
11641 | break; | ||
11642 | 12023 | ||
11643 | case 9: | 12024 | case 5: // scale and position sp |
11644 | Vector3 pos2 = new Vector3(block.Data, 0); | 12025 | udata.position = new Vector3(block.Data, 0); |
12026 | udata.scale = new Vector3(block.Data, 12); | ||
11645 | 12027 | ||
11646 | UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; | 12028 | udata.change = ObjectChangeType.primPS; |
12029 | updatehandler(localId, udata, this); | ||
12030 | break; | ||
11647 | 12031 | ||
11648 | if (handlerUpdateVector != null) | 12032 | case 0x15: //uniform scale and position |
11649 | { | 12033 | udata.position = new Vector3(block.Data, 0); |
11650 | handlerUpdateVector(localId, pos2, this); | 12034 | udata.scale = new Vector3(block.Data, 12); |
11651 | } | ||
11652 | break; | ||
11653 | 12035 | ||
11654 | case 10: | 12036 | udata.change = ObjectChangeType.primPUS; |
11655 | Quaternion rot3 = new Quaternion(block.Data, 0, true); | 12037 | updatehandler(localId, udata, this); |
12038 | break; | ||
11656 | 12039 | ||
11657 | UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; | 12040 | // now group related (bit 4) |
11658 | if (handlerUpdatePrimRotation != null) | 12041 | case 9: //( 8 + 1 )group position |
11659 | { | 12042 | udata.position = new Vector3(block.Data, 0); |
11660 | // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W); | ||
11661 | handlerUpdatePrimRotation(localId, rot3, this); | ||
11662 | } | ||
11663 | break; | ||
11664 | 12043 | ||
11665 | case 11: | 12044 | udata.change = ObjectChangeType.groupP; |
11666 | Vector3 pos3 = new Vector3(block.Data, 0); | 12045 | updatehandler(localId, udata, this); |
11667 | Quaternion rot4 = new Quaternion(block.Data, 12, true); | 12046 | break; |
11668 | 12047 | ||
11669 | handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; | 12048 | case 0x0A: // (8 + 2) group rotation |
11670 | if (handlerUpdatePrimGroupRotation != null) | 12049 | udata.rotation = new Quaternion(block.Data, 0, true); |
11671 | { | ||
11672 | // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
11673 | // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W); | ||
11674 | handlerUpdatePrimGroupRotation(localId, pos3, rot4, this); | ||
11675 | } | ||
11676 | break; | ||
11677 | case 12: | ||
11678 | case 28: | ||
11679 | Vector3 scale7 = new Vector3(block.Data, 0); | ||
11680 | 12050 | ||
11681 | UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | 12051 | udata.change = ObjectChangeType.groupR; |
11682 | if (handlerUpdatePrimGroupScale != null) | 12052 | updatehandler(localId, udata, this); |
11683 | { | 12053 | break; |
11684 | // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); | ||
11685 | handlerUpdatePrimGroupScale(localId, scale7, this); | ||
11686 | } | ||
11687 | break; | ||
11688 | 12054 | ||
11689 | case 13: | 12055 | case 0x0B: //( 8 + 2 + 1) group rotation and position |
11690 | Vector3 scale2 = new Vector3(block.Data, 12); | 12056 | udata.position = new Vector3(block.Data, 0); |
11691 | Vector3 pos4 = new Vector3(block.Data, 0); | 12057 | udata.rotation = new Quaternion(block.Data, 12, true); |
11692 | 12058 | ||
11693 | handlerUpdatePrimScale = OnUpdatePrimScale; | 12059 | udata.change = ObjectChangeType.groupPR; |
11694 | if (handlerUpdatePrimScale != null) | 12060 | updatehandler(localId, udata, this); |
11695 | { | 12061 | break; |
11696 | //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11697 | handlerUpdatePrimScale(localId, scale2, this); | ||
11698 | 12062 | ||
11699 | // Change the position based on scale (for bug number 246) | 12063 | case 0x0C: // (8 + 4) group scale |
11700 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 12064 | // only afects root prim and only sent by viewer editor object tab scaling |
11701 | // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 12065 | // mouse edition only allows uniform scaling |
11702 | if (handlerUpdatePrimSinglePosition != null) | 12066 | // SL MAY CHANGE THIS in viewers |
11703 | { | ||
11704 | handlerUpdatePrimSinglePosition(localId, pos4, this); | ||
11705 | } | ||
11706 | } | ||
11707 | break; | ||
11708 | 12067 | ||
11709 | case 29: | 12068 | udata.scale = new Vector3(block.Data, 0); |
11710 | Vector3 scale5 = new Vector3(block.Data, 12); | ||
11711 | Vector3 pos5 = new Vector3(block.Data, 0); | ||
11712 | 12069 | ||
11713 | handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | 12070 | udata.change = ObjectChangeType.groupS; |
11714 | if (handlerUpdatePrimGroupScale != null) | 12071 | updatehandler(localId, udata, this); |
11715 | { | ||
11716 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11717 | part.StoreUndoState(true); | ||
11718 | part.IgnoreUndoUpdate = true; | ||
11719 | handlerUpdatePrimGroupScale(localId, scale5, this); | ||
11720 | handlerUpdateVector = OnUpdatePrimGroupPosition; | ||
11721 | 12072 | ||
11722 | if (handlerUpdateVector != null) | 12073 | break; |
11723 | { | ||
11724 | handlerUpdateVector(localId, pos5, this); | ||
11725 | } | ||
11726 | 12074 | ||
11727 | part.IgnoreUndoUpdate = false; | 12075 | case 0x0D: //(8 + 4 + 1) group scale and position |
11728 | } | 12076 | // exception as above |
11729 | 12077 | ||
11730 | break; | 12078 | udata.position = new Vector3(block.Data, 0); |
12079 | udata.scale = new Vector3(block.Data, 12); | ||
11731 | 12080 | ||
11732 | case 21: | 12081 | udata.change = ObjectChangeType.groupPS; |
11733 | Vector3 scale6 = new Vector3(block.Data, 12); | 12082 | updatehandler(localId, udata, this); |
11734 | Vector3 pos6 = new Vector3(block.Data, 0); | 12083 | break; |
11735 | 12084 | ||
11736 | handlerUpdatePrimScale = OnUpdatePrimScale; | 12085 | case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM |
11737 | if (handlerUpdatePrimScale != null) | 12086 | udata.scale = new Vector3(block.Data, 0); |
11738 | { | ||
11739 | part.StoreUndoState(false); | ||
11740 | part.IgnoreUndoUpdate = true; | ||
11741 | 12087 | ||
11742 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | 12088 | udata.change = ObjectChangeType.groupUS; |
11743 | handlerUpdatePrimScale(localId, scale6, this); | 12089 | updatehandler(localId, udata, this); |
11744 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 12090 | break; |
11745 | if (handlerUpdatePrimSinglePosition != null) | ||
11746 | { | ||
11747 | handlerUpdatePrimSinglePosition(localId, pos6, this); | ||
11748 | } | ||
11749 | 12091 | ||
11750 | part.IgnoreUndoUpdate = false; | 12092 | case 0x1D: // (UNIFORM + GROUP + SCALE + POS) |
11751 | } | 12093 | udata.position = new Vector3(block.Data, 0); |
11752 | break; | 12094 | udata.scale = new Vector3(block.Data, 12); |
11753 | 12095 | ||
11754 | default: | 12096 | udata.change = ObjectChangeType.groupPUS; |
11755 | m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); | 12097 | updatehandler(localId, udata, this); |
11756 | break; | 12098 | break; |
12099 | |||
12100 | default: | ||
12101 | m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); | ||
12102 | break; | ||
12103 | } | ||
11757 | } | 12104 | } |
11758 | 12105 | ||
11759 | // for (int j = 0; j < parts.Length; j++) | ||
11760 | // parts[j].IgnoreUndoUpdate = false; | ||
11761 | } | 12106 | } |
11762 | } | 12107 | } |
11763 | } | 12108 | } |
11764 | |||
11765 | return true; | 12109 | return true; |
11766 | } | 12110 | } |
11767 | 12111 | ||
@@ -11822,9 +12166,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11822 | public void SetChildAgentThrottle(byte[] throttles) | 12166 | public void SetChildAgentThrottle(byte[] throttles) |
11823 | { | 12167 | { |
11824 | m_udpClient.SetThrottles(throttles); | 12168 | m_udpClient.SetThrottles(throttles); |
12169 | GenericCall2 handler = OnUpdateThrottles; | ||
12170 | if (handler != null) | ||
12171 | { | ||
12172 | handler(); | ||
12173 | } | ||
11825 | } | 12174 | } |
11826 | 12175 | ||
11827 | /// <summary> | 12176 | /// <summary> |
12177 | /// Sets the throttles from values supplied by the client | ||
12178 | /// </summary> | ||
12179 | /// <param name="throttles"></param> | ||
12180 | public void SetAgentThrottleSilent(int throttle, int setting) | ||
12181 | { | ||
12182 | m_udpClient.ForceThrottleSetting(throttle,setting); | ||
12183 | //m_udpClient.SetThrottles(throttles); | ||
12184 | |||
12185 | } | ||
12186 | |||
12187 | |||
12188 | /// <summary> | ||
11828 | /// Get the current throttles for this client as a packed byte array | 12189 | /// Get the current throttles for this client as a packed byte array |
11829 | /// </summary> | 12190 | /// </summary> |
11830 | /// <param name="multiplier">Unused</param> | 12191 | /// <param name="multiplier">Unused</param> |
@@ -12216,7 +12577,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12216 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", | 12577 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", |
12217 | // requestID, taskID, (SourceType)sourceType, Name); | 12578 | // requestID, taskID, (SourceType)sourceType, Name); |
12218 | 12579 | ||
12580 | |||
12581 | //Note, the bool returned from the below function is useless since it is always false. | ||
12219 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); | 12582 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); |
12583 | |||
12220 | } | 12584 | } |
12221 | 12585 | ||
12222 | /// <summary> | 12586 | /// <summary> |
@@ -12282,7 +12646,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12282 | /// <returns></returns> | 12646 | /// <returns></returns> |
12283 | private static int CalculateNumPackets(byte[] data) | 12647 | private static int CalculateNumPackets(byte[] data) |
12284 | { | 12648 | { |
12285 | const uint m_maxPacketSize = 600; | 12649 | // const uint m_maxPacketSize = 600; |
12650 | uint m_maxPacketSize = MaxTransferBytesPerPacket; | ||
12286 | int numPackets = 1; | 12651 | int numPackets = 1; |
12287 | 12652 | ||
12288 | if (data == null) | 12653 | if (data == null) |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 621e0fd..e52ac37 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -92,7 +92,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
92 | /// <summary>Packets we have sent that need to be ACKed by the client</summary> | 92 | /// <summary>Packets we have sent that need to be ACKed by the client</summary> |
93 | public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); | 93 | public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); |
94 | /// <summary>ACKs that are queued up, waiting to be sent to the client</summary> | 94 | /// <summary>ACKs that are queued up, waiting to be sent to the client</summary> |
95 | public readonly OpenSim.Framework.LocklessQueue<uint> PendingAcks = new OpenSim.Framework.LocklessQueue<uint>(); | 95 | public readonly DoubleLocklessQueue<uint> PendingAcks = new DoubleLocklessQueue<uint>(); |
96 | 96 | ||
97 | /// <summary>Current packet sequence number</summary> | 97 | /// <summary>Current packet sequence number</summary> |
98 | public int CurrentSequence; | 98 | public int CurrentSequence; |
@@ -146,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
146 | /// <summary>Throttle buckets for each packet category</summary> | 146 | /// <summary>Throttle buckets for each packet category</summary> |
147 | private readonly TokenBucket[] m_throttleCategories; | 147 | private readonly TokenBucket[] m_throttleCategories; |
148 | /// <summary>Outgoing queues for throttled packets</summary> | 148 | /// <summary>Outgoing queues for throttled packets</summary> |
149 | private readonly OpenSim.Framework.LocklessQueue<OutgoingPacket>[] m_packetOutboxes = new OpenSim.Framework.LocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT]; | 149 | private readonly DoubleLocklessQueue<OutgoingPacket>[] m_packetOutboxes = new DoubleLocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT]; |
150 | /// <summary>A container that can hold one packet for each outbox, used to store | 150 | /// <summary>A container that can hold one packet for each outbox, used to store |
151 | /// dequeued packets that are being held for throttling</summary> | 151 | /// dequeued packets that are being held for throttling</summary> |
152 | private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT]; | 152 | private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT]; |
@@ -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 |
@@ -201,7 +202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
201 | ThrottleOutPacketType type = (ThrottleOutPacketType)i; | 202 | ThrottleOutPacketType type = (ThrottleOutPacketType)i; |
202 | 203 | ||
203 | // Initialize the packet outboxes, where packets sit while they are waiting for tokens | 204 | // Initialize the packet outboxes, where packets sit while they are waiting for tokens |
204 | m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); | 205 | m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>(); |
205 | // Initialize the token buckets that control the throttling for each category | 206 | // Initialize the token buckets that control the throttling for each category |
206 | m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type)); | 207 | m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type)); |
207 | } | 208 | } |
@@ -429,11 +430,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
429 | /// </returns> | 430 | /// </returns> |
430 | public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue) | 431 | public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue) |
431 | { | 432 | { |
433 | return EnqueueOutgoing(packet, forceQueue, false); | ||
434 | } | ||
435 | |||
436 | public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue, bool highPriority) | ||
437 | { | ||
432 | int category = (int)packet.Category; | 438 | int category = (int)packet.Category; |
433 | 439 | ||
434 | if (category >= 0 && category < m_packetOutboxes.Length) | 440 | if (category >= 0 && category < m_packetOutboxes.Length) |
435 | { | 441 | { |
436 | OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; | 442 | DoubleLocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; |
443 | |||
444 | if (m_deliverPackets == false) | ||
445 | { | ||
446 | queue.Enqueue(packet, highPriority); | ||
447 | return true; | ||
448 | } | ||
449 | |||
437 | TokenBucket bucket = m_throttleCategories[category]; | 450 | TokenBucket bucket = m_throttleCategories[category]; |
438 | 451 | ||
439 | // Don't send this packet if there is already a packet waiting in the queue | 452 | // Don't send this packet if there is already a packet waiting in the queue |
@@ -441,7 +454,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
441 | // queued packets | 454 | // queued packets |
442 | if (queue.Count > 0) | 455 | if (queue.Count > 0) |
443 | { | 456 | { |
444 | queue.Enqueue(packet); | 457 | queue.Enqueue(packet, highPriority); |
445 | return true; | 458 | return true; |
446 | } | 459 | } |
447 | 460 | ||
@@ -454,7 +467,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
454 | else | 467 | else |
455 | { | 468 | { |
456 | // Force queue specified or not enough tokens in the bucket, queue this packet | 469 | // Force queue specified or not enough tokens in the bucket, queue this packet |
457 | queue.Enqueue(packet); | 470 | queue.Enqueue(packet, highPriority); |
458 | return true; | 471 | return true; |
459 | } | 472 | } |
460 | } | 473 | } |
@@ -483,8 +496,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
483 | /// <returns>True if any packets were sent, otherwise false</returns> | 496 | /// <returns>True if any packets were sent, otherwise false</returns> |
484 | public bool DequeueOutgoing() | 497 | public bool DequeueOutgoing() |
485 | { | 498 | { |
486 | OutgoingPacket packet; | 499 | if (m_deliverPackets == false) return false; |
487 | OpenSim.Framework.LocklessQueue<OutgoingPacket> queue; | 500 | |
501 | OutgoingPacket packet = null; | ||
502 | DoubleLocklessQueue<OutgoingPacket> queue; | ||
488 | TokenBucket bucket; | 503 | TokenBucket bucket; |
489 | bool packetSent = false; | 504 | bool packetSent = false; |
490 | ThrottleOutPacketTypeFlags emptyCategories = 0; | 505 | ThrottleOutPacketTypeFlags emptyCategories = 0; |
@@ -515,32 +530,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
515 | // No dequeued packet waiting to be sent, try to pull one off | 530 | // No dequeued packet waiting to be sent, try to pull one off |
516 | // this queue | 531 | // this queue |
517 | queue = m_packetOutboxes[i]; | 532 | queue = m_packetOutboxes[i]; |
518 | if (queue.Dequeue(out packet)) | 533 | if (queue != null) |
519 | { | 534 | { |
520 | // A packet was pulled off the queue. See if we have | 535 | bool success = false; |
521 | // enough tokens in the bucket to send it out | 536 | try |
522 | if (bucket.RemoveTokens(packet.Buffer.DataLength)) | ||
523 | { | 537 | { |
524 | // Send the packet | 538 | success = queue.Dequeue(out packet); |
525 | m_udpServer.SendPacketFinal(packet); | ||
526 | packetSent = true; | ||
527 | } | 539 | } |
528 | else | 540 | catch |
529 | { | 541 | { |
530 | // Save the dequeued packet for the next iteration | 542 | m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>(); |
531 | m_nextPackets[i] = packet; | ||
532 | } | 543 | } |
533 | 544 | if (success) | |
534 | // If the queue is empty after this dequeue, fire the queue | 545 | { |
535 | // empty callback now so it has a chance to fill before we | 546 | // A packet was pulled off the queue. See if we have |
536 | // get back here | 547 | // enough tokens in the bucket to send it out |
537 | if (queue.Count == 0) | 548 | if (bucket.RemoveTokens(packet.Buffer.DataLength)) |
549 | { | ||
550 | // Send the packet | ||
551 | m_udpServer.SendPacketFinal(packet); | ||
552 | packetSent = true; | ||
553 | } | ||
554 | else | ||
555 | { | ||
556 | // Save the dequeued packet for the next iteration | ||
557 | m_nextPackets[i] = packet; | ||
558 | } | ||
559 | |||
560 | // If the queue is empty after this dequeue, fire the queue | ||
561 | // empty callback now so it has a chance to fill before we | ||
562 | // get back here | ||
563 | if (queue.Count == 0) | ||
564 | emptyCategories |= CategoryToFlag(i); | ||
565 | } | ||
566 | else | ||
567 | { | ||
568 | // No packets in this queue. Fire the queue empty callback | ||
569 | // if it has not been called recently | ||
538 | emptyCategories |= CategoryToFlag(i); | 570 | emptyCategories |= CategoryToFlag(i); |
571 | } | ||
539 | } | 572 | } |
540 | else | 573 | else |
541 | { | 574 | { |
542 | // No packets in this queue. Fire the queue empty callback | 575 | m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>(); |
543 | // if it has not been called recently | ||
544 | emptyCategories |= CategoryToFlag(i); | 576 | emptyCategories |= CategoryToFlag(i); |
545 | } | 577 | } |
546 | } | 578 | } |
@@ -649,6 +681,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
649 | if (m_nextOnQueueEmpty == 0) | 681 | if (m_nextOnQueueEmpty == 0) |
650 | m_nextOnQueueEmpty = 1; | 682 | m_nextOnQueueEmpty = 1; |
651 | } | 683 | } |
684 | internal void ForceThrottleSetting(int throttle, int setting) | ||
685 | { | ||
686 | m_throttleCategories[throttle].RequestedDripRate = Math.Max(setting, LLUDPServer.MTU); ; | ||
687 | } | ||
652 | 688 | ||
653 | /// <summary> | 689 | /// <summary> |
654 | /// Converts a <seealso cref="ThrottleOutPacketType"/> integer to a | 690 | /// Converts a <seealso cref="ThrottleOutPacketType"/> integer to a |
@@ -693,4 +729,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
693 | } | 729 | } |
694 | } | 730 | } |
695 | } | 731 | } |
732 | |||
733 | public class DoubleLocklessQueue<T> : OpenSim.Framework.LocklessQueue<T> | ||
734 | { | ||
735 | OpenSim.Framework.LocklessQueue<T> highQueue = new OpenSim.Framework.LocklessQueue<T>(); | ||
736 | |||
737 | public override int Count | ||
738 | { | ||
739 | get | ||
740 | { | ||
741 | return base.Count + highQueue.Count; | ||
742 | } | ||
743 | } | ||
744 | |||
745 | public override bool Dequeue(out T item) | ||
746 | { | ||
747 | if (highQueue.Dequeue(out item)) | ||
748 | return true; | ||
749 | |||
750 | return base.Dequeue(out item); | ||
751 | } | ||
752 | |||
753 | public void Enqueue(T item, bool highPriority) | ||
754 | { | ||
755 | if (highPriority) | ||
756 | highQueue.Enqueue(item); | ||
757 | else | ||
758 | Enqueue(item); | ||
759 | } | ||
760 | } | ||
696 | } | 761 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 8eb2e06..fab66ce 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -121,7 +121,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
121 | /// <summary>Handlers for incoming packets</summary> | 121 | /// <summary>Handlers for incoming packets</summary> |
122 | //PacketEventDictionary packetEvents = new PacketEventDictionary(); | 122 | //PacketEventDictionary packetEvents = new PacketEventDictionary(); |
123 | /// <summary>Incoming packets that are awaiting handling</summary> | 123 | /// <summary>Incoming packets that are awaiting handling</summary> |
124 | private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); | 124 | //private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); |
125 | |||
126 | private DoubleQueue<IncomingPacket> packetInbox = new DoubleQueue<IncomingPacket>(); | ||
125 | 127 | ||
126 | /// <summary></summary> | 128 | /// <summary></summary> |
127 | //private UDPClientCollection m_clients = new UDPClientCollection(); | 129 | //private UDPClientCollection m_clients = new UDPClientCollection(); |
@@ -176,6 +178,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
176 | /// <summary>Flag to signal when clients should send pings</summary> | 178 | /// <summary>Flag to signal when clients should send pings</summary> |
177 | protected bool m_sendPing; | 179 | protected bool m_sendPing; |
178 | 180 | ||
181 | private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); | ||
179 | private Pool<IncomingPacket> m_incomingPacketPool; | 182 | private Pool<IncomingPacket> m_incomingPacketPool; |
180 | 183 | ||
181 | /// <summary> | 184 | /// <summary> |
@@ -782,6 +785,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
782 | 785 | ||
783 | #region Queue or Send | 786 | #region Queue or Send |
784 | 787 | ||
788 | bool highPriority = false; | ||
789 | |||
790 | if (category != ThrottleOutPacketType.Unknown && (category & ThrottleOutPacketType.HighPriority) != 0) | ||
791 | { | ||
792 | category = (ThrottleOutPacketType)((int)category & 127); | ||
793 | highPriority = true; | ||
794 | } | ||
795 | |||
785 | OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null); | 796 | OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null); |
786 | // If we were not provided a method for handling unacked, use the UDPServer default method | 797 | // If we were not provided a method for handling unacked, use the UDPServer default method |
787 | outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method); | 798 | outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method); |
@@ -790,7 +801,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
790 | // continue to display the deleted object until relog. Therefore, we need to always queue a kill object | 801 | // continue to display the deleted object until relog. Therefore, we need to always queue a kill object |
791 | // packet so that it isn't sent before a queued update packet. | 802 | // packet so that it isn't sent before a queued update packet. |
792 | bool requestQueue = type == PacketType.KillObject; | 803 | bool requestQueue = type == PacketType.KillObject; |
793 | if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue)) | 804 | if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority)) |
794 | SendPacketFinal(outgoingPacket); | 805 | SendPacketFinal(outgoingPacket); |
795 | 806 | ||
796 | #endregion Queue or Send | 807 | #endregion Queue or Send |
@@ -1075,21 +1086,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1075 | 1086 | ||
1076 | #region Packet to Client Mapping | 1087 | #region Packet to Client Mapping |
1077 | 1088 | ||
1078 | // UseCircuitCode handling | 1089 | // If there is already a client for this endpoint, don't process UseCircuitCode |
1079 | if (packet.Type == PacketType.UseCircuitCode) | 1090 | IClientAPI client = null; |
1091 | if (!m_scene.TryGetClient(endPoint, out client) || !(client is LLClientView)) | ||
1080 | { | 1092 | { |
1081 | // We need to copy the endpoint so that it doesn't get changed when another thread reuses the | 1093 | // UseCircuitCode handling |
1082 | // buffer. | 1094 | if (packet.Type == PacketType.UseCircuitCode) |
1083 | object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet }; | 1095 | { |
1096 | // And if there is a UseCircuitCode pending, also drop it | ||
1097 | lock (m_pendingCache) | ||
1098 | { | ||
1099 | if (m_pendingCache.Contains(endPoint)) | ||
1100 | return; | ||
1084 | 1101 | ||
1085 | Util.FireAndForget(HandleUseCircuitCode, array); | 1102 | m_pendingCache.AddOrUpdate(endPoint, new Queue<UDPPacketBuffer>(), 60); |
1103 | } | ||
1086 | 1104 | ||
1087 | return; | 1105 | // We need to copy the endpoint so that it doesn't get changed when another thread reuses the |
1106 | // buffer. | ||
1107 | object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet }; | ||
1108 | |||
1109 | Util.FireAndForget(HandleUseCircuitCode, array); | ||
1110 | |||
1111 | return; | ||
1112 | } | ||
1113 | } | ||
1114 | |||
1115 | // If this is a pending connection, enqueue, don't process yet | ||
1116 | lock (m_pendingCache) | ||
1117 | { | ||
1118 | Queue<UDPPacketBuffer> queue; | ||
1119 | if (m_pendingCache.TryGetValue(endPoint, out queue)) | ||
1120 | { | ||
1121 | //m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); | ||
1122 | queue.Enqueue(buffer); | ||
1123 | return; | ||
1124 | } | ||
1088 | } | 1125 | } |
1089 | 1126 | ||
1090 | // Determine which agent this packet came from | 1127 | // Determine which agent this packet came from |
1091 | IClientAPI client; | 1128 | if (client == null || !(client is LLClientView)) |
1092 | if (!m_scene.TryGetClient(endPoint, out client) || !(client is LLClientView)) | ||
1093 | { | 1129 | { |
1094 | //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); | 1130 | //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); |
1095 | return; | 1131 | return; |
@@ -1098,7 +1134,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1098 | udpClient = ((LLClientView)client).UDPClient; | 1134 | udpClient = ((LLClientView)client).UDPClient; |
1099 | 1135 | ||
1100 | if (!udpClient.IsConnected) | 1136 | if (!udpClient.IsConnected) |
1137 | { | ||
1138 | // m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); | ||
1101 | return; | 1139 | return; |
1140 | } | ||
1102 | 1141 | ||
1103 | #endregion Packet to Client Mapping | 1142 | #endregion Packet to Client Mapping |
1104 | 1143 | ||
@@ -1228,7 +1267,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1228 | incomingPacket = new IncomingPacket((LLClientView)client, packet); | 1267 | incomingPacket = new IncomingPacket((LLClientView)client, packet); |
1229 | } | 1268 | } |
1230 | 1269 | ||
1231 | packetInbox.Enqueue(incomingPacket); | 1270 | if (incomingPacket.Packet.Type == PacketType.AgentUpdate || |
1271 | incomingPacket.Packet.Type == PacketType.ChatFromViewer) | ||
1272 | packetInbox.EnqueueHigh(incomingPacket); | ||
1273 | else | ||
1274 | packetInbox.EnqueueLow(incomingPacket); | ||
1232 | } | 1275 | } |
1233 | 1276 | ||
1234 | #region BinaryStats | 1277 | #region BinaryStats |
@@ -1376,10 +1419,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1376 | { | 1419 | { |
1377 | AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); | 1420 | AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); |
1378 | bool tp = (aCircuit.teleportFlags > 0); | 1421 | bool tp = (aCircuit.teleportFlags > 0); |
1379 | // Let's delay this for TP agents, otherwise the viewer doesn't know where to get meshes from | ||
1380 | if (!tp) | 1422 | if (!tp) |
1381 | client.SceneAgent.SendInitialDataToMe(); | 1423 | client.SceneAgent.SendInitialDataToMe(); |
1382 | } | 1424 | } |
1425 | |||
1426 | // Now we know we can handle more data | ||
1427 | Thread.Sleep(200); | ||
1428 | |||
1429 | // Obtain the queue and remove it from the cache | ||
1430 | Queue<UDPPacketBuffer> queue = null; | ||
1431 | |||
1432 | lock (m_pendingCache) | ||
1433 | { | ||
1434 | if (!m_pendingCache.TryGetValue(endPoint, out queue)) | ||
1435 | { | ||
1436 | m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present"); | ||
1437 | return; | ||
1438 | } | ||
1439 | m_pendingCache.Remove(endPoint); | ||
1440 | } | ||
1441 | |||
1442 | m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); | ||
1443 | |||
1444 | // Reinject queued packets | ||
1445 | while(queue.Count > 0) | ||
1446 | { | ||
1447 | UDPPacketBuffer buf = queue.Dequeue(); | ||
1448 | PacketReceived(buf); | ||
1449 | } | ||
1450 | queue = null; | ||
1383 | } | 1451 | } |
1384 | else | 1452 | else |
1385 | { | 1453 | { |
@@ -1387,6 +1455,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1387 | m_log.WarnFormat( | 1455 | m_log.WarnFormat( |
1388 | "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", | 1456 | "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", |
1389 | uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); | 1457 | uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); |
1458 | lock (m_pendingCache) | ||
1459 | m_pendingCache.Remove(endPoint); | ||
1390 | } | 1460 | } |
1391 | 1461 | ||
1392 | // m_log.DebugFormat( | 1462 | // m_log.DebugFormat( |
@@ -1505,7 +1575,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1505 | if (!client.SceneAgent.IsChildAgent) | 1575 | if (!client.SceneAgent.IsChildAgent) |
1506 | client.Kick("Simulator logged you out due to connection timeout"); | 1576 | client.Kick("Simulator logged you out due to connection timeout"); |
1507 | 1577 | ||
1508 | client.CloseWithoutChecks(); | 1578 | client.CloseWithoutChecks(true); |
1509 | } | 1579 | } |
1510 | } | 1580 | } |
1511 | 1581 | ||
@@ -1517,6 +1587,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1517 | 1587 | ||
1518 | while (IsRunningInbound) | 1588 | while (IsRunningInbound) |
1519 | { | 1589 | { |
1590 | m_scene.ThreadAlive(1); | ||
1520 | try | 1591 | try |
1521 | { | 1592 | { |
1522 | IncomingPacket incomingPacket = null; | 1593 | IncomingPacket incomingPacket = null; |
@@ -1564,6 +1635,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1564 | 1635 | ||
1565 | while (base.IsRunningOutbound) | 1636 | while (base.IsRunningOutbound) |
1566 | { | 1637 | { |
1638 | m_scene.ThreadAlive(2); | ||
1567 | try | 1639 | try |
1568 | { | 1640 | { |
1569 | m_packetSent = false; | 1641 | m_packetSent = false; |
@@ -1794,8 +1866,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1794 | Packet packet = incomingPacket.Packet; | 1866 | Packet packet = incomingPacket.Packet; |
1795 | LLClientView client = incomingPacket.Client; | 1867 | LLClientView client = incomingPacket.Client; |
1796 | 1868 | ||
1797 | if (client.IsActive) | 1869 | // if (client.IsActive) |
1798 | { | 1870 | // { |
1799 | m_currentIncomingClient = client; | 1871 | m_currentIncomingClient = client; |
1800 | 1872 | ||
1801 | try | 1873 | try |
@@ -1822,13 +1894,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1822 | { | 1894 | { |
1823 | m_currentIncomingClient = null; | 1895 | m_currentIncomingClient = null; |
1824 | } | 1896 | } |
1825 | } | 1897 | // } |
1826 | else | 1898 | // else |
1827 | { | 1899 | // { |
1828 | m_log.DebugFormat( | 1900 | // m_log.DebugFormat( |
1829 | "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", | 1901 | // "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", |
1830 | packet.Type, client.Name, m_scene.RegionInfo.RegionName); | 1902 | // packet.Type, client.Name, m_scene.RegionInfo.RegionName); |
1831 | } | 1903 | // } |
1832 | 1904 | ||
1833 | IncomingPacketsProcessed++; | 1905 | IncomingPacketsProcessed++; |
1834 | } | 1906 | } |
@@ -1840,8 +1912,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1840 | if (!client.IsLoggingOut) | 1912 | if (!client.IsLoggingOut) |
1841 | { | 1913 | { |
1842 | client.IsLoggingOut = true; | 1914 | client.IsLoggingOut = true; |
1843 | client.Close(); | 1915 | client.Close(false, false); |
1844 | } | 1916 | } |
1845 | } | 1917 | } |
1846 | } | 1918 | } |
1847 | } \ No newline at end of file | 1919 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index f143c32..7035e38 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | |||
@@ -114,10 +114,6 @@ namespace OpenMetaverse | |||
114 | const int SIO_UDP_CONNRESET = -1744830452; | 114 | const int SIO_UDP_CONNRESET = -1744830452; |
115 | 115 | ||
116 | IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort); | 116 | IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort); |
117 | |||
118 | m_log.DebugFormat( | ||
119 | "[UDPBASE]: Binding UDP listener using internal IP address config {0}:{1}", | ||
120 | ipep.Address, ipep.Port); | ||
121 | 117 | ||
122 | m_udpSocket = new Socket( | 118 | m_udpSocket = new Socket( |
123 | AddressFamily.InterNetwork, | 119 | AddressFamily.InterNetwork, |