aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs3
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs251
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs10
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs66
5 files changed, 192 insertions, 140 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 4aa19d1..bcfb633 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,6 +336,7 @@ 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;
@@ -377,6 +379,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
377 get { return m_startpos; } 379 get { return m_startpos; }
378 set { m_startpos = value; } 380 set { m_startpos = value; }
379 } 381 }
382 public bool DeliverPackets
383 {
384 get { return m_deliverPackets; }
385 set {
386 m_deliverPackets = value;
387 m_udpClient.m_deliverPackets = value;
388 }
389 }
380 public UUID AgentId { get { return m_agentId; } } 390 public UUID AgentId { get { return m_agentId; } }
381 public UUID ActiveGroupId { get { return m_activeGroupID; } } 391 public UUID ActiveGroupId { get { return m_activeGroupID; } }
382 public string ActiveGroupName { get { return m_activeGroupName; } } 392 public string ActiveGroupName { get { return m_activeGroupName; } }
@@ -475,18 +485,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
475 485
476 #region Client Methods 486 #region Client Methods
477 487
488
478 /// <summary> 489 /// <summary>
479 /// Shut down the client view 490 /// Shut down the client view
480 /// </summary> 491 /// </summary>
481 public void Close() 492 public void Close()
482 { 493 {
494 Close(true);
495 }
496
497 /// <summary>
498 /// Shut down the client view
499 /// </summary>
500 public void Close(bool sendStop)
501 {
483 m_log.DebugFormat( 502 m_log.DebugFormat(
484 "[CLIENT]: Close has been called for {0} attached to scene {1}", 503 "[CLIENT]: Close has been called for {0} attached to scene {1}",
485 Name, m_scene.RegionInfo.RegionName); 504 Name, m_scene.RegionInfo.RegionName);
486 505
487 // Send the STOP packet 506 if (sendStop)
488 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); 507 {
489 OutPacket(disable, ThrottleOutPacketType.Unknown); 508 // Send the STOP packet
509 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
510 OutPacket(disable, ThrottleOutPacketType.Unknown);
511 }
490 512
491 IsActive = false; 513 IsActive = false;
492 514
@@ -766,7 +788,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
766 reply.ChatData.OwnerID = fromAgentID; 788 reply.ChatData.OwnerID = fromAgentID;
767 reply.ChatData.SourceID = fromAgentID; 789 reply.ChatData.SourceID = fromAgentID;
768 790
769 OutPacket(reply, ThrottleOutPacketType.Task); 791 OutPacket(reply, ThrottleOutPacketType.Unknown);
770 } 792 }
771 793
772 /// <summary> 794 /// <summary>
@@ -1052,6 +1074,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1052 public virtual void SendLayerData(float[] map) 1074 public virtual void SendLayerData(float[] map)
1053 { 1075 {
1054 Util.FireAndForget(DoSendLayerData, map); 1076 Util.FireAndForget(DoSendLayerData, map);
1077
1078 // Send it sync, and async. It's not that much data
1079 // and it improves user experience just so much!
1080 DoSendLayerData(map);
1055 } 1081 }
1056 1082
1057 /// <summary> 1083 /// <summary>
@@ -1064,16 +1090,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1064 1090
1065 try 1091 try
1066 { 1092 {
1067 //for (int y = 0; y < 16; y++) 1093 for (int y = 0; y < 16; y++)
1068 //{ 1094 {
1069 // for (int x = 0; x < 16; x++) 1095 for (int x = 0; x < 16; x+=4)
1070 // { 1096 {
1071 // SendLayerData(x, y, map); 1097 SendLayerPacket(x, y, map);
1072 // } 1098 }
1073 //} 1099 }
1074
1075 // Send LayerData in a spiral pattern. Fun!
1076 SendLayerTopRight(map, 0, 0, 15, 15);
1077 } 1100 }
1078 catch (Exception e) 1101 catch (Exception e)
1079 { 1102 {
@@ -1081,51 +1104,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1081 } 1104 }
1082 } 1105 }
1083 1106
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> 1107 /// <summary>
1113 /// Sends a set of four patches (x, x+1, ..., x+3) to the client 1108 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1114 /// </summary> 1109 /// </summary>
1115 /// <param name="map">heightmap</param> 1110 /// <param name="map">heightmap</param>
1116 /// <param name="px">X coordinate for patches 0..12</param> 1111 /// <param name="px">X coordinate for patches 0..12</param>
1117 /// <param name="py">Y coordinate for patches 0..15</param> 1112 /// <param name="py">Y coordinate for patches 0..15</param>
1118 // private void SendLayerPacket(float[] map, int y, int x) 1113 private void SendLayerPacket(int x, int y, float[] map)
1119 // { 1114 {
1120 // int[] patches = new int[4]; 1115 int[] patches = new int[4];
1121 // patches[0] = x + 0 + y * 16; 1116 patches[0] = x + 0 + y * 16;
1122 // patches[1] = x + 1 + y * 16; 1117 patches[1] = x + 1 + y * 16;
1123 // patches[2] = x + 2 + y * 16; 1118 patches[2] = x + 2 + y * 16;
1124 // patches[3] = x + 3 + y * 16; 1119 patches[3] = x + 3 + y * 16;
1125 1120
1126 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); 1121 float[] heightmap = (map.Length == 65536) ?
1127 // OutPacket(layerpack, ThrottleOutPacketType.Land); 1122 map :
1128 // } 1123 LLHeightFieldMoronize(map);
1124
1125 try
1126 {
1127 Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1128 OutPacket(layerpack, ThrottleOutPacketType.Land);
1129 }
1130 catch
1131 {
1132 for (int px = x ; px < x + 4 ; px++)
1133 SendLayerData(px, y, map);
1134 }
1135 }
1129 1136
1130 /// <summary> 1137 /// <summary>
1131 /// Sends a specified patch to a client 1138 /// Sends a specified patch to a client
@@ -1145,7 +1152,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1145 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); 1152 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1146 layerpack.Header.Reliable = true; 1153 layerpack.Header.Reliable = true;
1147 1154
1148 OutPacket(layerpack, ThrottleOutPacketType.Land); 1155 OutPacket(layerpack, ThrottleOutPacketType.Task);
1149 } 1156 }
1150 catch (Exception e) 1157 catch (Exception e)
1151 { 1158 {
@@ -1506,35 +1513,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1506 OutPacket(pc, ThrottleOutPacketType.Unknown); 1513 OutPacket(pc, ThrottleOutPacketType.Unknown);
1507 } 1514 }
1508 1515
1509 public void SendKillObject(ulong regionHandle, uint localID) 1516 public void SendKillObject(ulong regionHandle, List<uint> localIDs)
1510 { 1517 {
1511// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); 1518// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle);
1512 1519
1513 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); 1520 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
1514 // TODO: don't create new blocks if recycling an old packet 1521 // TODO: don't create new blocks if recycling an old packet
1515 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 1522 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[localIDs.Count];
1516 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 1523 for (int i = 0 ; i < localIDs.Count ; i++ )
1517 kill.ObjectData[0].ID = localID; 1524 {
1525 kill.ObjectData[i] = new KillObjectPacket.ObjectDataBlock();
1526 kill.ObjectData[i].ID = localIDs[i];
1527 }
1518 kill.Header.Reliable = true; 1528 kill.Header.Reliable = true;
1519 kill.Header.Zerocoded = true; 1529 kill.Header.Zerocoded = true;
1520 1530
1521 if (m_scene.GetScenePresence(localID) == null) 1531 if (localIDs.Count == 1)
1522 { 1532 {
1523 lock (m_entityUpdates.SyncRoot) 1533 if (m_scene.GetScenePresence(localIDs[0]) != null)
1524 { 1534 {
1525 m_killRecord.Add(localID); 1535 OutPacket(kill, ThrottleOutPacketType.State);
1526 1536 return;
1527 // The throttle queue used here must match that being used for updates. Otherwise, there is a
1528 // chance that a kill packet put on a separate queue will be sent to the client before an existing
1529 // update packet on another queue. Receiving updates after kills results in unowned and undeletable
1530 // scene objects in a viewer until that viewer is relogged in.
1531 OutPacket(kill, ThrottleOutPacketType.Task);
1532 } 1537 }
1538 m_killRecord.Add(localIDs[0]);
1533 } 1539 }
1534 else 1540 else
1535 { 1541 {
1536 OutPacket(kill, ThrottleOutPacketType.State); 1542 lock (m_entityUpdates.SyncRoot)
1543 {
1544 foreach (uint localID in localIDs)
1545 m_killRecord.Add(localID);
1546 }
1537 } 1547 }
1548
1549 // The throttle queue used here must match that being used for
1550 // updates. Otherwise, there is a chance that a kill packet put
1551 // on a separate queue will be sent to the client before an
1552 // existing update packet on another queue. Receiving updates
1553 // after kills results in unowned and undeletable
1554 // scene objects in a viewer until that viewer is relogged in.
1555 OutPacket(kill, ThrottleOutPacketType.Task);
1538 } 1556 }
1539 1557
1540 /// <summary> 1558 /// <summary>
@@ -2240,6 +2258,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2240 OutPacket(sound, ThrottleOutPacketType.Task); 2258 OutPacket(sound, ThrottleOutPacketType.Task);
2241 } 2259 }
2242 2260
2261 public void SendTransferAbort(TransferRequestPacket transferRequest)
2262 {
2263 TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort);
2264 abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID;
2265 abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType;
2266 m_log.Debug("[Assets] Aborting transfer; asset request failed");
2267 OutPacket(abort, ThrottleOutPacketType.Task);
2268 }
2269
2243 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) 2270 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
2244 { 2271 {
2245 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); 2272 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger);
@@ -3541,6 +3568,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3541 /// </summary> 3568 /// </summary>
3542 public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) 3569 public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
3543 { 3570 {
3571 if (entity is SceneObjectPart)
3572 {
3573 SceneObjectPart e = (SceneObjectPart)entity;
3574 SceneObjectGroup g = e.ParentGroup;
3575 if (g.RootPart.Shape.State > 30) // HUD
3576 if (g.OwnerID != AgentId)
3577 return; // Don't send updates for other people's HUDs
3578 }
3579
3544 double priority = m_prioritizer.GetUpdatePriority(this, entity); 3580 double priority = m_prioritizer.GetUpdatePriority(this, entity);
3545 3581
3546 lock (m_entityUpdates.SyncRoot) 3582 lock (m_entityUpdates.SyncRoot)
@@ -3561,23 +3597,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3561 EntityUpdate update; 3597 EntityUpdate update;
3562 while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update)) 3598 while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update))
3563 { 3599 {
3564 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client 3600 // If we have sent a kill packet for this object
3565 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good 3601 // drop any updates on the floor
3566 // safety measure.
3567 //
3568 // Receiving updates after kills results in undeleteable prims that persist until relog and
3569 // currently occurs because prims can be deleted before all queued updates are sent.
3570 if (m_killRecord.Contains(update.Entity.LocalId))
3571 {
3572// m_log.WarnFormat(
3573// "[CLIENT]: Preventing full update for prim with local id {0} after client for user {1} told it was deleted",
3574// update.Entity.LocalId, Name);
3575 continue;
3576 }
3577
3578 if (update.Entity is SceneObjectPart) 3602 if (update.Entity is SceneObjectPart)
3579 { 3603 {
3580 SceneObjectPart part = (SceneObjectPart)update.Entity; 3604 SceneObjectPart part = (SceneObjectPart)update.Entity;
3605 if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId))
3606 continue;
3581 3607
3582 if (part.ParentGroup.IsAttachment && m_disableFacelights) 3608 if (part.ParentGroup.IsAttachment && m_disableFacelights)
3583 { 3609 {
@@ -4011,6 +4037,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4011 { 4037 {
4012 m_propertiesPacketTimer.Stop(); 4038 m_propertiesPacketTimer.Stop();
4013 4039
4040 if (m_propertiesBlocks.Count == 0)
4041 return;
4042
4014 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; 4043 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count];
4015 4044
4016 int index = 0; 4045 int index = 0;
@@ -4917,6 +4946,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4917 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); 4946 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false);
4918 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); 4947 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false);
4919 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); 4948 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode);
4949 AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments);
4920 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); 4950 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false);
4921 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); 4951 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents);
4922 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); 4952 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery);
@@ -5016,6 +5046,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5016 (x.CameraLeftAxis != lastarg.CameraLeftAxis) || 5046 (x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
5017 (x.CameraUpAxis != lastarg.CameraUpAxis) || 5047 (x.CameraUpAxis != lastarg.CameraUpAxis) ||
5018 (x.ControlFlags != lastarg.ControlFlags) || 5048 (x.ControlFlags != lastarg.ControlFlags) ||
5049 (x.ControlFlags != 0) ||
5019 (x.Far != lastarg.Far) || 5050 (x.Far != lastarg.Far) ||
5020 (x.Flags != lastarg.Flags) || 5051 (x.Flags != lastarg.Flags) ||
5021 (x.State != lastarg.State) || 5052 (x.State != lastarg.State) ||
@@ -5389,7 +5420,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5389 args.Channel = ch; 5420 args.Channel = ch;
5390 args.From = String.Empty; 5421 args.From = String.Empty;
5391 args.Message = Utils.BytesToString(msg); 5422 args.Message = Utils.BytesToString(msg);
5392 args.Type = ChatTypeEnum.Shout; 5423 args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance
5393 args.Position = new Vector3(); 5424 args.Position = new Vector3();
5394 args.Scene = Scene; 5425 args.Scene = Scene;
5395 args.Sender = this; 5426 args.Sender = this;
@@ -9428,6 +9459,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9428 { 9459 {
9429 return true; 9460 return true;
9430 } 9461 }
9462
9463 private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack)
9464 {
9465 CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack;
9466
9467 #region Packet Session and User Check
9468 if (m_checkPackets)
9469 {
9470 if (packet.AgentData.SessionID != SessionId ||
9471 packet.AgentData.AgentID != AgentId)
9472 return true;
9473 }
9474 #endregion
9475 MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null;
9476 List<InventoryItemBase> items = new List<InventoryItemBase>();
9477 foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData)
9478 {
9479 InventoryItemBase b = new InventoryItemBase();
9480 b.ID = n.OldItemID;
9481 b.Folder = n.OldFolderID;
9482 items.Add(b);
9483 }
9484
9485 handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy;
9486 if (handlerMoveItemsAndLeaveCopy != null)
9487 {
9488 handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID);
9489 }
9490
9491 return true;
9492 }
9431 9493
9432 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) 9494 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack)
9433 { 9495 {
@@ -10925,7 +10987,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10925 { 10987 {
10926 // It's a ghost! tell the client to delete it from view. 10988 // It's a ghost! tell the client to delete it from view.
10927 simClient.SendKillObject(Scene.RegionInfo.RegionHandle, 10989 simClient.SendKillObject(Scene.RegionInfo.RegionHandle,
10928 localId); 10990 new List<uint>() { localId });
10929 } 10991 }
10930 else 10992 else
10931 { 10993 {
@@ -11295,22 +11357,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11295 /// <param name="Pack">OpenMetaverse.packet</param> 11357 /// <param name="Pack">OpenMetaverse.packet</param>
11296 public void ProcessInPacket(Packet packet) 11358 public void ProcessInPacket(Packet packet)
11297 { 11359 {
11298 if (m_debugPacketLevel > 0) 11360 if (m_debugPacketLevel >= 255)
11299 { 11361 m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type);
11300 bool outputPacket = true;
11301
11302 if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate)
11303 outputPacket = false;
11304
11305 if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage)
11306 outputPacket = false;
11307
11308 if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation))
11309 outputPacket = false;
11310
11311 if (outputPacket)
11312 m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type);
11313 }
11314 11362
11315 if (!ProcessPacketMethod(packet)) 11363 if (!ProcessPacketMethod(packet))
11316 m_log.Warn("[CLIENT]: unhandled packet " + packet.Type); 11364 m_log.Warn("[CLIENT]: unhandled packet " + packet.Type);
@@ -11552,7 +11600,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11552 11600
11553// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); 11601// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
11554 11602
11603
11604 //Note, the bool returned from the below function is useless since it is always false.
11555 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); 11605 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
11606
11556 } 11607 }
11557 11608
11558 /// <summary> 11609 /// <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 b5d8ec8..59968a1 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -934,7 +934,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
934 if (m_scene.TryGetClient(udpClient.AgentID, out client)) 934 if (m_scene.TryGetClient(udpClient.AgentID, out client))
935 { 935 {
936 client.IsLoggingOut = true; 936 client.IsLoggingOut = true;
937 client.Close(); 937 client.Close(false);
938 } 938 }
939 } 939 }
940 940
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}