aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2019-02-26 15:09:18 +0000
committerUbitUmarov2019-02-26 15:09:18 +0000
commitfe46f8cd1ddbf3d37e8be4a3771ce5124024d6f8 (patch)
tree8c7afa03c1c27b651af290b0ffc122465baba5ca /OpenSim
parent issues with udp buffers pool on heavy load (diff)
downloadopensim-SC-fe46f8cd1ddbf3d37e8be4a3771ce5124024d6f8.zip
opensim-SC-fe46f8cd1ddbf3d37e8be4a3771ce5124024d6f8.tar.gz
opensim-SC-fe46f8cd1ddbf3d37e8be4a3771ce5124024d6f8.tar.bz2
opensim-SC-fe46f8cd1ddbf3d37e8be4a3771ce5124024d6f8.tar.xz
avoid packet split on terseupdates
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs106
1 files changed, 76 insertions, 30 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 3cb9388..f28534b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4094,11 +4094,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4094 return; 4094 return;
4095 4095
4096 List<ObjectUpdatePacket.ObjectDataBlock> objectUpdateBlocks = null; 4096 List<ObjectUpdatePacket.ObjectDataBlock> objectUpdateBlocks = null;
4097 List<ObjectUpdateCompressedPacket.ObjectDataBlock> compressedUpdateBlocks = null; 4097 // List<ObjectUpdateCompressedPacket.ObjectDataBlock> compressedUpdateBlocks = null;
4098 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> terseUpdateBlocks = null;
4099 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> terseAgentUpdateBlocks = null;
4100 List<EntityUpdate> objectUpdates = null; 4098 List<EntityUpdate> objectUpdates = null;
4101 List<EntityUpdate> compressedUpdates = null; 4099 // List<EntityUpdate> compressedUpdates = null;
4102 List<EntityUpdate> terseUpdates = null; 4100 List<EntityUpdate> terseUpdates = null;
4103 List<EntityUpdate> terseAgentUpdates = null; 4101 List<EntityUpdate> terseAgentUpdates = null;
4104 List<SceneObjectPart> ObjectAnimationUpdates = null; 4102 List<SceneObjectPart> ObjectAnimationUpdates = null;
@@ -4321,32 +4319,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4321 4319
4322 if ((updateFlags & canNotUseImprovedMask) == 0) 4320 if ((updateFlags & canNotUseImprovedMask) == 0)
4323 { 4321 {
4324 ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock =
4325 CreateImprovedTerseBlock(update.Entity);
4326 4322
4327 if (update.Entity is ScenePresence) 4323 if (update.Entity is ScenePresence)
4328 { 4324 {
4329 // ALL presence updates go into a special list 4325 // ALL presence updates go into a special list
4330 if (terseAgentUpdateBlocks == null) 4326 if (terseAgentUpdates == null)
4331 { 4327 {
4332 terseAgentUpdateBlocks = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
4333 terseAgentUpdates = new List<EntityUpdate>(); 4328 terseAgentUpdates = new List<EntityUpdate>();
4329 maxUpdatesBytes -= 18;
4334 } 4330 }
4335 terseAgentUpdateBlocks.Add(ablock);
4336 terseAgentUpdates.Add(update); 4331 terseAgentUpdates.Add(update);
4332 maxUpdatesBytes -= 63; // no texture entry
4337 } 4333 }
4338 else 4334 else
4339 { 4335 {
4340 // Everything else goes here 4336 // Everything else goes here
4341 if (terseUpdateBlocks == null) 4337 if (terseUpdates == null)
4342 { 4338 {
4343 terseUpdateBlocks = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
4344 terseUpdates = new List<EntityUpdate>(); 4339 terseUpdates = new List<EntityUpdate>();
4340 maxUpdatesBytes -= 18;
4345 } 4341 }
4346 terseUpdateBlocks.Add(ablock);
4347 terseUpdates.Add(update); 4342 terseUpdates.Add(update);
4343 maxUpdatesBytes -= 47; // no texture entry
4348 } 4344 }
4349 maxUpdatesBytes -= ablock.Length;
4350 } 4345 }
4351 else 4346 else
4352 { 4347 {
@@ -4359,6 +4354,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4359 { 4354 {
4360 objectUpdateBlocks = new List<ObjectUpdatePacket.ObjectDataBlock>(); 4355 objectUpdateBlocks = new List<ObjectUpdatePacket.ObjectDataBlock>();
4361 objectUpdates = new List<EntityUpdate>(); 4356 objectUpdates = new List<EntityUpdate>();
4357 maxUpdatesBytes -= 18;
4362 } 4358 }
4363 objectUpdateBlocks.Add(ablock); 4359 objectUpdateBlocks.Add(ablock);
4364 objectUpdates.Add(update); 4360 objectUpdates.Add(update);
@@ -4377,16 +4373,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4377 4373
4378 timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); 4374 timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
4379 4375
4380 if (terseAgentUpdateBlocks != null) 4376 if (terseAgentUpdates != null)
4381 { 4377 {
4378 const int maxNBlocks = (LLUDPServer.MTU - 18) / 63; // no texture entry
4379 int blocks = terseAgentUpdates.Count;
4380
4382 ImprovedTerseObjectUpdatePacket packet 4381 ImprovedTerseObjectUpdatePacket packet
4383 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 4382 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
4384 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4383 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4385 packet.RegionData.TimeDilation = timeDilation; 4384 packet.RegionData.TimeDilation = timeDilation;
4386 packet.ObjectData = terseAgentUpdateBlocks.ToArray();
4387 terseAgentUpdateBlocks.Clear();
4388 4385
4389 OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates, oPacket); }); 4386 int curNBlocks = blocks > maxNBlocks ? maxNBlocks : blocks;
4387 List<EntityUpdate> tau = new List<EntityUpdate>(curNBlocks);
4388 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[curNBlocks];
4389
4390 int count = 0;
4391 foreach (EntityUpdate eu in terseAgentUpdates)
4392 {
4393 packet.ObjectData[count++] = CreateImprovedTerseBlock(eu.Entity);
4394 tau.Add(eu);
4395 --blocks;
4396 if (count == curNBlocks && blocks > 0)
4397 {
4398 OutPacket(packet, ThrottleOutPacketType.Unknown, false, delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); });
4399 packet = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
4400 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4401 packet.RegionData.TimeDilation = timeDilation;
4402
4403 curNBlocks = blocks > maxNBlocks ? maxNBlocks : blocks;
4404 tau = new List<EntityUpdate>(curNBlocks);
4405 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[curNBlocks];
4406 count = 0;
4407 }
4408 }
4409
4410 if (tau.Count > 0)
4411 OutPacket(packet, ThrottleOutPacketType.Unknown, false, delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); });
4390 } 4412 }
4391 4413
4392 if (objectUpdateBlocks != null) 4414 if (objectUpdateBlocks != null)
@@ -4399,7 +4421,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4399 4421
4400 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates, oPacket); }); 4422 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates, oPacket); });
4401 } 4423 }
4402 4424/*
4403 if (compressedUpdateBlocks != null) 4425 if (compressedUpdateBlocks != null)
4404 { 4426 {
4405 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); 4427 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
@@ -4410,20 +4432,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4410 4432
4411 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates, oPacket); }); 4433 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates, oPacket); });
4412 } 4434 }
4413 4435*/
4414 if (terseUpdateBlocks != null) 4436 if (terseUpdates != null)
4415 { 4437 {
4416 ImprovedTerseObjectUpdatePacket packet = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( 4438 const int maxNBlocks = (LLUDPServer.MTU - 18) / 47; // no texture entry
4417 PacketType.ImprovedTerseObjectUpdate); 4439 int blocks = terseUpdates.Count;
4440
4441 ImprovedTerseObjectUpdatePacket packet =
4442 (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
4418 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4443 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4419 packet.RegionData.TimeDilation = timeDilation; 4444 packet.RegionData.TimeDilation = timeDilation;
4420 packet.ObjectData = terseUpdateBlocks.ToArray();
4421 terseUpdateBlocks.Clear();
4422 4445
4423 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates, oPacket); }); 4446 int curNBlocks = blocks > maxNBlocks ? maxNBlocks : blocks;
4447 List<EntityUpdate> tau = new List<EntityUpdate>(curNBlocks);
4448 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[curNBlocks];
4449
4450 int count = 0;
4451 foreach (EntityUpdate eu in terseUpdates)
4452 {
4453 packet.ObjectData[count++] = CreateImprovedTerseBlock(eu.Entity);
4454 tau.Add(eu);
4455 --blocks;
4456 if (count == curNBlocks && blocks > 0)
4457 {
4458 OutPacket(packet, ThrottleOutPacketType.Task, false, delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); });
4459 packet = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
4460 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4461 packet.RegionData.TimeDilation = timeDilation;
4462
4463 curNBlocks = blocks > maxNBlocks ? maxNBlocks : blocks;
4464 tau = new List<EntityUpdate>(curNBlocks);
4465 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[curNBlocks];
4466 count = 0;
4467 }
4468 }
4469
4470 if (tau.Count > 0)
4471 OutPacket(packet, ThrottleOutPacketType.Task, false, delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); });
4424 } 4472 }
4425 4473
4426 if(ObjectAnimationUpdates != null) 4474 if (ObjectAnimationUpdates != null)
4427 { 4475 {
4428 foreach (SceneObjectPart sop in ObjectAnimationUpdates) 4476 foreach (SceneObjectPart sop in ObjectAnimationUpdates)
4429 { 4477 {
@@ -4637,9 +4685,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4637 // These are used to implement an adaptive backoff in the number 4685 // These are used to implement an adaptive backoff in the number
4638 // of updates converted to packets. Since we don't want packets 4686 // of updates converted to packets. Since we don't want packets
4639 // to sit in the queue with old data, only convert enough updates 4687 // to sit in the queue with old data, only convert enough updates
4640 // to packets that can be sent in 200ms. 4688 // to packets that can be sent in 30ms.
4641// private Int32 m_LastQueueFill = 0;
4642// private Int32 m_maxUpdates = 0;
4643 4689
4644 void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories) 4690 void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories)
4645 { 4691 {