diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 210 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 27 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs | 66 |
5 files changed, 206 insertions, 110 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index e9e2dca..9dd6663 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | |||
@@ -202,6 +202,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
202 | m_stopPacket = TexturePacketCount(); | 202 | m_stopPacket = TexturePacketCount(); |
203 | } | 203 | } |
204 | 204 | ||
205 | //Give them at least two packets, to play nice with some broken viewers (SL also behaves this way) | ||
206 | if (m_stopPacket == 1 && Layers[0].End > FIRST_PACKET_SIZE) m_stopPacket++; | ||
207 | |||
205 | m_currentPacket = StartPacket; | 208 | m_currentPacket = StartPacket; |
206 | } | 209 | } |
207 | } | 210 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 48d5a12..2b1bd97 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -155,6 +155,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
155 | public event RequestTaskInventory OnRequestTaskInventory; | 155 | public event RequestTaskInventory OnRequestTaskInventory; |
156 | public event UpdateInventoryItem OnUpdateInventoryItem; | 156 | public event UpdateInventoryItem OnUpdateInventoryItem; |
157 | public event CopyInventoryItem OnCopyInventoryItem; | 157 | public event CopyInventoryItem OnCopyInventoryItem; |
158 | public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | ||
158 | public event MoveInventoryItem OnMoveInventoryItem; | 159 | public event MoveInventoryItem OnMoveInventoryItem; |
159 | public event RemoveInventoryItem OnRemoveInventoryItem; | 160 | public event RemoveInventoryItem OnRemoveInventoryItem; |
160 | public event RemoveInventoryFolder OnRemoveInventoryFolder; | 161 | public event RemoveInventoryFolder OnRemoveInventoryFolder; |
@@ -335,11 +336,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
335 | // protected HashSet<uint> m_attachmentsSent; | 336 | // protected HashSet<uint> m_attachmentsSent; |
336 | 337 | ||
337 | private int m_moneyBalance; | 338 | private int m_moneyBalance; |
339 | private bool m_deliverPackets = true; | ||
338 | private int m_animationSequenceNumber = 1; | 340 | private int m_animationSequenceNumber = 1; |
339 | private bool m_SendLogoutPacketWhenClosing = true; | 341 | private bool m_SendLogoutPacketWhenClosing = true; |
340 | private AgentUpdateArgs lastarg; | 342 | private AgentUpdateArgs lastarg; |
341 | private bool m_IsActive = true; | 343 | private bool m_IsActive = true; |
342 | private bool m_IsLoggingOut = false; | 344 | private bool m_IsLoggingOut = false; |
345 | private bool m_IsPresenceReady = false; | ||
343 | 346 | ||
344 | protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); | 347 | protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); |
345 | protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers | 348 | protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers |
@@ -362,6 +365,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
362 | 365 | ||
363 | private Timer m_propertiesPacketTimer; | 366 | private Timer m_propertiesPacketTimer; |
364 | private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>(); | 367 | private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>(); |
368 | private List<Packet> m_pendingPackets; | ||
365 | 369 | ||
366 | #endregion Class Members | 370 | #endregion Class Members |
367 | 371 | ||
@@ -377,6 +381,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
377 | get { return m_startpos; } | 381 | get { return m_startpos; } |
378 | set { m_startpos = value; } | 382 | set { m_startpos = value; } |
379 | } | 383 | } |
384 | public bool DeliverPackets | ||
385 | { | ||
386 | get { return m_deliverPackets; } | ||
387 | set { | ||
388 | m_deliverPackets = value; | ||
389 | m_udpClient.m_deliverPackets = value; | ||
390 | } | ||
391 | } | ||
380 | public UUID AgentId { get { return m_agentId; } } | 392 | public UUID AgentId { get { return m_agentId; } } |
381 | public UUID ActiveGroupId { get { return m_activeGroupID; } } | 393 | public UUID ActiveGroupId { get { return m_activeGroupID; } } |
382 | public string ActiveGroupName { get { return m_activeGroupName; } } | 394 | public string ActiveGroupName { get { return m_activeGroupName; } } |
@@ -406,6 +418,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
406 | get { return m_IsActive; } | 418 | get { return m_IsActive; } |
407 | set { m_IsActive = value; } | 419 | set { m_IsActive = value; } |
408 | } | 420 | } |
421 | |||
409 | public bool IsLoggingOut | 422 | public bool IsLoggingOut |
410 | { | 423 | { |
411 | get { return m_IsLoggingOut; } | 424 | get { return m_IsLoggingOut; } |
@@ -475,18 +488,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
475 | 488 | ||
476 | #region Client Methods | 489 | #region Client Methods |
477 | 490 | ||
491 | |||
478 | /// <summary> | 492 | /// <summary> |
479 | /// Shut down the client view | 493 | /// Shut down the client view |
480 | /// </summary> | 494 | /// </summary> |
481 | public void Close() | 495 | public void Close() |
482 | { | 496 | { |
497 | Close(true); | ||
498 | } | ||
499 | |||
500 | /// <summary> | ||
501 | /// Shut down the client view | ||
502 | /// </summary> | ||
503 | public void Close(bool sendStop) | ||
504 | { | ||
483 | m_log.DebugFormat( | 505 | m_log.DebugFormat( |
484 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 506 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
485 | Name, m_scene.RegionInfo.RegionName); | 507 | Name, m_scene.RegionInfo.RegionName); |
486 | 508 | ||
487 | // Send the STOP packet | 509 | if (sendStop) |
488 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | 510 | { |
489 | OutPacket(disable, ThrottleOutPacketType.Unknown); | 511 | // Send the STOP packet |
512 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
513 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
514 | } | ||
490 | 515 | ||
491 | IsActive = false; | 516 | IsActive = false; |
492 | 517 | ||
@@ -766,7 +791,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
766 | reply.ChatData.OwnerID = fromAgentID; | 791 | reply.ChatData.OwnerID = fromAgentID; |
767 | reply.ChatData.SourceID = fromAgentID; | 792 | reply.ChatData.SourceID = fromAgentID; |
768 | 793 | ||
769 | OutPacket(reply, ThrottleOutPacketType.Task); | 794 | OutPacket(reply, ThrottleOutPacketType.Unknown); |
770 | } | 795 | } |
771 | 796 | ||
772 | /// <summary> | 797 | /// <summary> |
@@ -1052,6 +1077,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1052 | public virtual void SendLayerData(float[] map) | 1077 | public virtual void SendLayerData(float[] map) |
1053 | { | 1078 | { |
1054 | Util.FireAndForget(DoSendLayerData, map); | 1079 | Util.FireAndForget(DoSendLayerData, map); |
1080 | |||
1081 | // Send it sync, and async. It's not that much data | ||
1082 | // and it improves user experience just so much! | ||
1083 | DoSendLayerData(map); | ||
1055 | } | 1084 | } |
1056 | 1085 | ||
1057 | /// <summary> | 1086 | /// <summary> |
@@ -1064,16 +1093,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1064 | 1093 | ||
1065 | try | 1094 | try |
1066 | { | 1095 | { |
1067 | //for (int y = 0; y < 16; y++) | 1096 | for (int y = 0; y < 16; y++) |
1068 | //{ | 1097 | { |
1069 | // for (int x = 0; x < 16; x++) | 1098 | for (int x = 0; x < 16; x+=4) |
1070 | // { | 1099 | { |
1071 | // SendLayerData(x, y, map); | 1100 | SendLayerPacket(x, y, map); |
1072 | // } | 1101 | } |
1073 | //} | 1102 | } |
1074 | |||
1075 | // Send LayerData in a spiral pattern. Fun! | ||
1076 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
1077 | } | 1103 | } |
1078 | catch (Exception e) | 1104 | catch (Exception e) |
1079 | { | 1105 | { |
@@ -1081,51 +1107,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1081 | } | 1107 | } |
1082 | } | 1108 | } |
1083 | 1109 | ||
1084 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
1085 | { | ||
1086 | // Row | ||
1087 | for (int i = x1; i <= x2; i++) | ||
1088 | SendLayerData(i, y1, map); | ||
1089 | |||
1090 | // Column | ||
1091 | for (int j = y1 + 1; j <= y2; j++) | ||
1092 | SendLayerData(x2, j, map); | ||
1093 | |||
1094 | if (x2 - x1 > 0) | ||
1095 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
1096 | } | ||
1097 | |||
1098 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
1099 | { | ||
1100 | // Row in reverse | ||
1101 | for (int i = x2; i >= x1; i--) | ||
1102 | SendLayerData(i, y2, map); | ||
1103 | |||
1104 | // Column in reverse | ||
1105 | for (int j = y2 - 1; j >= y1; j--) | ||
1106 | SendLayerData(x1, j, map); | ||
1107 | |||
1108 | if (x2 - x1 > 0) | ||
1109 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
1110 | } | ||
1111 | |||
1112 | /// <summary> | 1110 | /// <summary> |
1113 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 1111 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
1114 | /// </summary> | 1112 | /// </summary> |
1115 | /// <param name="map">heightmap</param> | 1113 | /// <param name="map">heightmap</param> |
1116 | /// <param name="px">X coordinate for patches 0..12</param> | 1114 | /// <param name="px">X coordinate for patches 0..12</param> |
1117 | /// <param name="py">Y coordinate for patches 0..15</param> | 1115 | /// <param name="py">Y coordinate for patches 0..15</param> |
1118 | // private void SendLayerPacket(float[] map, int y, int x) | 1116 | private void SendLayerPacket(int x, int y, float[] map) |
1119 | // { | 1117 | { |
1120 | // int[] patches = new int[4]; | 1118 | int[] patches = new int[4]; |
1121 | // patches[0] = x + 0 + y * 16; | 1119 | patches[0] = x + 0 + y * 16; |
1122 | // patches[1] = x + 1 + y * 16; | 1120 | patches[1] = x + 1 + y * 16; |
1123 | // patches[2] = x + 2 + y * 16; | 1121 | patches[2] = x + 2 + y * 16; |
1124 | // patches[3] = x + 3 + y * 16; | 1122 | patches[3] = x + 3 + y * 16; |
1125 | 1123 | ||
1126 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 1124 | float[] heightmap = (map.Length == 65536) ? |
1127 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1125 | map : |
1128 | // } | 1126 | LLHeightFieldMoronize(map); |
1127 | |||
1128 | try | ||
1129 | { | ||
1130 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1131 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1132 | } | ||
1133 | catch | ||
1134 | { | ||
1135 | for (int px = x ; px < x + 4 ; px++) | ||
1136 | SendLayerData(px, y, map); | ||
1137 | } | ||
1138 | } | ||
1129 | 1139 | ||
1130 | /// <summary> | 1140 | /// <summary> |
1131 | /// Sends a specified patch to a client | 1141 | /// Sends a specified patch to a client |
@@ -1145,7 +1155,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1145 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 1155 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); |
1146 | layerpack.Header.Reliable = true; | 1156 | layerpack.Header.Reliable = true; |
1147 | 1157 | ||
1148 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1158 | OutPacket(layerpack, ThrottleOutPacketType.Task); |
1149 | } | 1159 | } |
1150 | catch (Exception e) | 1160 | catch (Exception e) |
1151 | { | 1161 | { |
@@ -2240,6 +2250,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2240 | OutPacket(sound, ThrottleOutPacketType.Task); | 2250 | OutPacket(sound, ThrottleOutPacketType.Task); |
2241 | } | 2251 | } |
2242 | 2252 | ||
2253 | public void SendTransferAbort(TransferRequestPacket transferRequest) | ||
2254 | { | ||
2255 | TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort); | ||
2256 | abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID; | ||
2257 | abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType; | ||
2258 | m_log.Debug("[Assets] Aborting transfer; asset request failed"); | ||
2259 | OutPacket(abort, ThrottleOutPacketType.Task); | ||
2260 | } | ||
2261 | |||
2243 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) | 2262 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) |
2244 | { | 2263 | { |
2245 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); | 2264 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); |
@@ -3532,6 +3551,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3532 | /// </summary> | 3551 | /// </summary> |
3533 | public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) | 3552 | public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) |
3534 | { | 3553 | { |
3554 | if (entity is SceneObjectPart) | ||
3555 | { | ||
3556 | SceneObjectPart e = (SceneObjectPart)entity; | ||
3557 | SceneObjectGroup g = e.ParentGroup; | ||
3558 | if (g.RootPart.Shape.State > 30) // HUD | ||
3559 | if (g.OwnerID != AgentId) | ||
3560 | return; // Don't send updates for other people's HUDs | ||
3561 | } | ||
3562 | |||
3535 | double priority = m_prioritizer.GetUpdatePriority(this, entity); | 3563 | double priority = m_prioritizer.GetUpdatePriority(this, entity); |
3536 | 3564 | ||
3537 | lock (m_entityUpdates.SyncRoot) | 3565 | lock (m_entityUpdates.SyncRoot) |
@@ -3552,23 +3580,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3552 | EntityUpdate update; | 3580 | EntityUpdate update; |
3553 | while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update)) | 3581 | while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update)) |
3554 | { | 3582 | { |
3555 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client | 3583 | // If we have sent a kill packet for this object |
3556 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good | 3584 | // drop any updates on the floor |
3557 | // safety measure. | ||
3558 | // | ||
3559 | // Receiving updates after kills results in undeleteable prims that persist until relog and | ||
3560 | // currently occurs because prims can be deleted before all queued updates are sent. | ||
3561 | if (m_killRecord.Contains(update.Entity.LocalId)) | ||
3562 | { | ||
3563 | // m_log.WarnFormat( | ||
3564 | // "[CLIENT]: Preventing full update for prim with local id {0} after client for user {1} told it was deleted", | ||
3565 | // update.Entity.LocalId, Name); | ||
3566 | continue; | ||
3567 | } | ||
3568 | |||
3569 | if (update.Entity is SceneObjectPart) | 3585 | if (update.Entity is SceneObjectPart) |
3570 | { | 3586 | { |
3571 | SceneObjectPart part = (SceneObjectPart)update.Entity; | 3587 | SceneObjectPart part = (SceneObjectPart)update.Entity; |
3588 | if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) | ||
3589 | continue; | ||
3572 | 3590 | ||
3573 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | 3591 | if (part.ParentGroup.IsAttachment && m_disableFacelights) |
3574 | { | 3592 | { |
@@ -4002,6 +4020,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4002 | { | 4020 | { |
4003 | m_propertiesPacketTimer.Stop(); | 4021 | m_propertiesPacketTimer.Stop(); |
4004 | 4022 | ||
4023 | if (m_propertiesBlocks.Count == 0) | ||
4024 | return; | ||
4025 | |||
4005 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; | 4026 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; |
4006 | 4027 | ||
4007 | int index = 0; | 4028 | int index = 0; |
@@ -4908,6 +4929,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4908 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); | 4929 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); |
4909 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); | 4930 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); |
4910 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); | 4931 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); |
4932 | AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments); | ||
4911 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); | 4933 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); |
4912 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); | 4934 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); |
4913 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); | 4935 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); |
@@ -5007,6 +5029,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5007 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || | 5029 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || |
5008 | (x.CameraUpAxis != lastarg.CameraUpAxis) || | 5030 | (x.CameraUpAxis != lastarg.CameraUpAxis) || |
5009 | (x.ControlFlags != lastarg.ControlFlags) || | 5031 | (x.ControlFlags != lastarg.ControlFlags) || |
5032 | (x.ControlFlags != 0) || | ||
5010 | (x.Far != lastarg.Far) || | 5033 | (x.Far != lastarg.Far) || |
5011 | (x.Flags != lastarg.Flags) || | 5034 | (x.Flags != lastarg.Flags) || |
5012 | (x.State != lastarg.State) || | 5035 | (x.State != lastarg.State) || |
@@ -5380,7 +5403,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5380 | args.Channel = ch; | 5403 | args.Channel = ch; |
5381 | args.From = String.Empty; | 5404 | args.From = String.Empty; |
5382 | args.Message = Utils.BytesToString(msg); | 5405 | args.Message = Utils.BytesToString(msg); |
5383 | args.Type = ChatTypeEnum.Shout; | 5406 | args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance |
5384 | args.Position = new Vector3(); | 5407 | args.Position = new Vector3(); |
5385 | args.Scene = Scene; | 5408 | args.Scene = Scene; |
5386 | args.Sender = this; | 5409 | args.Sender = this; |
@@ -9418,6 +9441,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9418 | { | 9441 | { |
9419 | return true; | 9442 | return true; |
9420 | } | 9443 | } |
9444 | |||
9445 | private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack) | ||
9446 | { | ||
9447 | CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack; | ||
9448 | |||
9449 | #region Packet Session and User Check | ||
9450 | if (m_checkPackets) | ||
9451 | { | ||
9452 | if (packet.AgentData.SessionID != SessionId || | ||
9453 | packet.AgentData.AgentID != AgentId) | ||
9454 | return true; | ||
9455 | } | ||
9456 | #endregion | ||
9457 | MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null; | ||
9458 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
9459 | foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData) | ||
9460 | { | ||
9461 | InventoryItemBase b = new InventoryItemBase(); | ||
9462 | b.ID = n.OldItemID; | ||
9463 | b.Folder = n.OldFolderID; | ||
9464 | items.Add(b); | ||
9465 | } | ||
9466 | |||
9467 | handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy; | ||
9468 | if (handlerMoveItemsAndLeaveCopy != null) | ||
9469 | { | ||
9470 | handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID); | ||
9471 | } | ||
9472 | |||
9473 | return true; | ||
9474 | } | ||
9421 | 9475 | ||
9422 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) | 9476 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) |
9423 | { | 9477 | { |
@@ -11280,6 +11334,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11280 | } | 11334 | } |
11281 | 11335 | ||
11282 | /// <summary> | 11336 | /// <summary> |
11337 | /// This processes packets which have accumulated while the presence was still in the process of initialising. | ||
11338 | /// </summary> | ||
11339 | public void ProcessPendingPackets() | ||
11340 | { | ||
11341 | m_IsPresenceReady = true; | ||
11342 | if (m_pendingPackets == null) | ||
11343 | return; | ||
11344 | foreach (Packet p in m_pendingPackets) | ||
11345 | { | ||
11346 | ProcessInPacket(p); | ||
11347 | } | ||
11348 | m_pendingPackets.Clear(); | ||
11349 | } | ||
11350 | |||
11351 | /// <summary> | ||
11283 | /// Entryway from the client to the simulator. All UDP packets from the client will end up here | 11352 | /// Entryway from the client to the simulator. All UDP packets from the client will end up here |
11284 | /// </summary> | 11353 | /// </summary> |
11285 | /// <param name="Pack">OpenMetaverse.packet</param> | 11354 | /// <param name="Pack">OpenMetaverse.packet</param> |
@@ -11542,7 +11611,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11542 | 11611 | ||
11543 | // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); | 11612 | // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); |
11544 | 11613 | ||
11614 | |||
11615 | //Note, the bool returned from the below function is useless since it is always false. | ||
11545 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); | 11616 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); |
11617 | |||
11546 | } | 11618 | } |
11547 | 11619 | ||
11548 | /// <summary> | 11620 | /// <summary> |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index ca5a7bd..a4738ff 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | |||
@@ -149,6 +149,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
149 | 149 | ||
150 | private int m_defaultRTO = 3000; | 150 | private int m_defaultRTO = 3000; |
151 | private int m_maxRTO = 60000; | 151 | private int m_maxRTO = 60000; |
152 | public bool m_deliverPackets = true; | ||
152 | 153 | ||
153 | /// <summary> | 154 | /// <summary> |
154 | /// Default constructor | 155 | /// Default constructor |
@@ -389,6 +390,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
389 | if (category >= 0 && category < m_packetOutboxes.Length) | 390 | if (category >= 0 && category < m_packetOutboxes.Length) |
390 | { | 391 | { |
391 | OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; | 392 | OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; |
393 | |||
394 | if (m_deliverPackets == false) | ||
395 | { | ||
396 | queue.Enqueue(packet); | ||
397 | return true; | ||
398 | } | ||
399 | |||
392 | TokenBucket bucket = m_throttleCategories[category]; | 400 | TokenBucket bucket = m_throttleCategories[category]; |
393 | 401 | ||
394 | if (bucket.RemoveTokens(packet.Buffer.DataLength)) | 402 | if (bucket.RemoveTokens(packet.Buffer.DataLength)) |
@@ -425,6 +433,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
425 | /// <returns>True if any packets were sent, otherwise false</returns> | 433 | /// <returns>True if any packets were sent, otherwise false</returns> |
426 | public bool DequeueOutgoing() | 434 | public bool DequeueOutgoing() |
427 | { | 435 | { |
436 | if (m_deliverPackets == false) return false; | ||
437 | |||
428 | OutgoingPacket packet; | 438 | OutgoingPacket packet; |
429 | OpenSim.Framework.LocklessQueue<OutgoingPacket> queue; | 439 | OpenSim.Framework.LocklessQueue<OutgoingPacket> queue; |
430 | TokenBucket bucket; | 440 | TokenBucket bucket; |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index cb298fd..e2cda6d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -912,7 +912,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
912 | client.DisableFacelights = m_disableFacelights; | 912 | client.DisableFacelights = m_disableFacelights; |
913 | 913 | ||
914 | // Start the IClientAPI | 914 | // Start the IClientAPI |
915 | client.Start(); | 915 | // Spin it off so that it doesn't clog up the LLUDPServer |
916 | |||
917 | //First, and very importantly: | ||
918 | // | ||
919 | //Set our DeliverPackets flag in the client to *false* | ||
920 | //this will prevent us from missing important messages | ||
921 | //before the modules are bound | ||
922 | client.DeliverPackets = false; | ||
923 | client.DisableFacelights = m_disableFacelights; | ||
924 | |||
925 | Util.FireAndForget( | ||
926 | delegate | ||
927 | { | ||
928 | try | ||
929 | { | ||
930 | client.Start(); | ||
931 | } | ||
932 | finally | ||
933 | { | ||
934 | //Now, release the hounds. er, packets. | ||
935 | client.DeliverPackets = true; | ||
936 | } | ||
937 | } | ||
938 | ); | ||
916 | } | 939 | } |
917 | else | 940 | else |
918 | { | 941 | { |
@@ -928,7 +951,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
928 | if (m_scene.TryGetClient(udpClient.AgentID, out client)) | 951 | if (m_scene.TryGetClient(udpClient.AgentID, out client)) |
929 | { | 952 | { |
930 | client.IsLoggingOut = true; | 953 | client.IsLoggingOut = true; |
931 | client.Close(); | 954 | client.Close(false); |
932 | } | 955 | } |
933 | } | 956 | } |
934 | 957 | ||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs index bdbd284..91e3d20 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs | |||
@@ -133,7 +133,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
133 | this.parent = parent; | 133 | this.parent = parent; |
134 | MaxBurst = maxBurst; | 134 | MaxBurst = maxBurst; |
135 | DripRate = dripRate; | 135 | DripRate = dripRate; |
136 | lastDrip = Environment.TickCount & Int32.MaxValue; | 136 | lastDrip = Environment.TickCount; |
137 | } | 137 | } |
138 | 138 | ||
139 | /// <summary> | 139 | /// <summary> |
@@ -144,40 +144,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
144 | /// the bucket, otherwise false</returns> | 144 | /// the bucket, otherwise false</returns> |
145 | public bool RemoveTokens(int amount) | 145 | public bool RemoveTokens(int amount) |
146 | { | 146 | { |
147 | bool dummy; | ||
148 | return RemoveTokens(amount, out dummy); | ||
149 | } | ||
150 | |||
151 | /// <summary> | ||
152 | /// Remove a given number of tokens from the bucket | ||
153 | /// </summary> | ||
154 | /// <param name="amount">Number of tokens to remove from the bucket</param> | ||
155 | /// <param name="dripSucceeded">True if tokens were added to the bucket | ||
156 | /// during this call, otherwise false</param> | ||
157 | /// <returns>True if the requested number of tokens were removed from | ||
158 | /// the bucket, otherwise false</returns> | ||
159 | public bool RemoveTokens(int amount, out bool dripSucceeded) | ||
160 | { | ||
161 | if (maxBurst == 0) | 147 | if (maxBurst == 0) |
162 | { | 148 | { |
163 | dripSucceeded = true; | ||
164 | return true; | 149 | return true; |
165 | } | 150 | } |
166 | 151 | ||
167 | dripSucceeded = Drip(); | 152 | if (amount > maxBurst) |
168 | |||
169 | if (content - amount >= 0) | ||
170 | { | 153 | { |
171 | if (parent != null && !parent.RemoveTokens(amount)) | 154 | throw new Exception("amount " + amount + " exceeds maxBurst " + maxBurst); |
172 | return false; | 155 | } |
173 | 156 | ||
174 | content -= amount; | 157 | Drip(); |
175 | return true; | 158 | |
159 | if (content < amount) | ||
160 | { | ||
161 | return false; | ||
176 | } | 162 | } |
177 | else | 163 | |
164 | if (parent != null && !parent.RemoveTokens(amount)) | ||
178 | { | 165 | { |
179 | return false; | 166 | return false; |
180 | } | 167 | } |
168 | |||
169 | content -= amount; | ||
170 | return true; | ||
181 | } | 171 | } |
182 | 172 | ||
183 | /// <summary> | 173 | /// <summary> |
@@ -193,25 +183,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
193 | content = maxBurst; | 183 | content = maxBurst; |
194 | return true; | 184 | return true; |
195 | } | 185 | } |
196 | else | ||
197 | { | ||
198 | int now = Environment.TickCount & Int32.MaxValue; | ||
199 | int deltaMS = now - lastDrip; | ||
200 | 186 | ||
201 | if (deltaMS <= 0) | 187 | int now = Environment.TickCount; |
202 | { | 188 | int deltaMS = now - lastDrip; |
203 | if (deltaMS < 0) | 189 | lastDrip = now; |
204 | lastDrip = now; | ||
205 | return false; | ||
206 | } | ||
207 | 190 | ||
208 | int dripAmount = deltaMS * tokensPerMS; | 191 | if (deltaMS <= 0) |
209 | 192 | { | |
210 | content = Math.Min(content + dripAmount, maxBurst); | 193 | return false; |
211 | lastDrip = now; | 194 | } |
212 | 195 | ||
213 | return true; | 196 | long dripAmount = (long)deltaMS * (long)tokensPerMS + (long)content; |
197 | if (dripAmount > maxBurst) | ||
198 | { | ||
199 | dripAmount = maxBurst; | ||
214 | } | 200 | } |
201 | content = (int)dripAmount; | ||
202 | return true; | ||
215 | } | 203 | } |
216 | } | 204 | } |
217 | } | 205 | } |