diff options
Diffstat (limited to 'OpenSim/Region')
11 files changed, 274 insertions, 189 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 46c6a19..8ba26e8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -347,12 +347,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
347 | private const uint MaxTransferBytesPerPacket = 600; | 347 | private const uint MaxTransferBytesPerPacket = 600; |
348 | 348 | ||
349 | /// <value> | 349 | /// <value> |
350 | /// List used in construction of data blocks for an object update packet. This is to stop us having to | ||
351 | /// continually recreate it. | ||
352 | /// </value> | ||
353 | protected List<ObjectUpdatePacket.ObjectDataBlock> m_fullUpdateDataBlocksBuilder; | ||
354 | |||
355 | /// <value> | ||
356 | /// Maintain a record of all the objects killed. This allows us to stop an update being sent from the | 350 | /// Maintain a record of all the objects killed. This allows us to stop an update being sent from the |
357 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an | 351 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an |
358 | /// ownerless phantom. | 352 | /// ownerless phantom. |
@@ -511,7 +505,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
511 | m_scene = scene; | 505 | m_scene = scene; |
512 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); | 506 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); |
513 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); | 507 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); |
514 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); | ||
515 | m_killRecord = new List<uint>(); | 508 | m_killRecord = new List<uint>(); |
516 | // m_attachmentsSent = new HashSet<uint>(); | 509 | // m_attachmentsSent = new HashSet<uint>(); |
517 | 510 | ||
@@ -594,13 +587,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
594 | OutPacket(disable, ThrottleOutPacketType.Unknown); | 587 | OutPacket(disable, ThrottleOutPacketType.Unknown); |
595 | } | 588 | } |
596 | 589 | ||
597 | // Shutdown the image manager | ||
598 | ImageManager.Close(); | ||
599 | 590 | ||
600 | // Fire the callback for this connection closing | 591 | // Fire the callback for this connection closing |
601 | if (OnConnectionClosed != null) | 592 | if (OnConnectionClosed != null) |
602 | OnConnectionClosed(this); | 593 | OnConnectionClosed(this); |
603 | 594 | ||
595 | |||
604 | // Flush all of the packets out of the UDP server for this client | 596 | // Flush all of the packets out of the UDP server for this client |
605 | if (m_udpServer != null) | 597 | if (m_udpServer != null) |
606 | m_udpServer.Flush(m_udpClient); | 598 | m_udpServer.Flush(m_udpClient); |
@@ -615,8 +607,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
615 | 607 | ||
616 | // Disable UDP handling for this client | 608 | // Disable UDP handling for this client |
617 | m_udpClient.Shutdown(); | 609 | m_udpClient.Shutdown(); |
618 | 610 | ||
619 | 611 | m_udpClient.OnQueueEmpty -= HandleQueueEmpty; | |
612 | m_udpClient.HasUpdates -= HandleHasUpdates; | ||
613 | m_udpClient.OnPacketStats -= PopulateStats; | ||
614 | |||
615 | // Shutdown the image manager | ||
616 | ImageManager.Close(); | ||
617 | ImageManager = null; | ||
618 | |||
619 | m_entityUpdates = null; | ||
620 | m_entityProps = null; | ||
621 | m_killRecord.Clear(); | ||
622 | GroupsInView.Clear(); | ||
623 | m_scene = null; | ||
620 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 624 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
621 | //GC.Collect(); | 625 | //GC.Collect(); |
622 | //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 626 | //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
@@ -814,7 +818,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
814 | public void ProcessSpecificPacketAsync(object state) | 818 | public void ProcessSpecificPacketAsync(object state) |
815 | { | 819 | { |
816 | AsyncPacketProcess packetObject = (AsyncPacketProcess)state; | 820 | AsyncPacketProcess packetObject = (AsyncPacketProcess)state; |
817 | 821 | ||
818 | try | 822 | try |
819 | { | 823 | { |
820 | packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack); | 824 | packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack); |
@@ -4095,19 +4099,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4095 | ResendPrimUpdate(update); | 4099 | ResendPrimUpdate(update); |
4096 | } | 4100 | } |
4097 | 4101 | ||
4102 | private List<ObjectUpdatePacket.ObjectDataBlock> objectUpdateBlocks = new List<ObjectUpdatePacket.ObjectDataBlock>(); | ||
4103 | private List<ObjectUpdateCompressedPacket.ObjectDataBlock> compressedUpdateBlocks = new List<ObjectUpdateCompressedPacket.ObjectDataBlock>(); | ||
4104 | private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> terseUpdateBlocks = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); | ||
4105 | private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> terseAgentUpdateBlocks = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); | ||
4106 | |||
4098 | private void ProcessEntityUpdates(int maxUpdatesBytes) | 4107 | private void ProcessEntityUpdates(int maxUpdatesBytes) |
4099 | { | 4108 | { |
4100 | OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); | ||
4101 | OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); | ||
4102 | OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); | ||
4103 | OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); | ||
4104 | |||
4105 | OpenSim.Framework.Lazy<List<EntityUpdate>> objectUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); | 4109 | OpenSim.Framework.Lazy<List<EntityUpdate>> objectUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); |
4106 | OpenSim.Framework.Lazy<List<EntityUpdate>> compressedUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); | 4110 | OpenSim.Framework.Lazy<List<EntityUpdate>> compressedUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); |
4107 | OpenSim.Framework.Lazy<List<EntityUpdate>> terseUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); | 4111 | OpenSim.Framework.Lazy<List<EntityUpdate>> terseUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); |
4108 | OpenSim.Framework.Lazy<List<EntityUpdate>> terseAgentUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); | 4112 | OpenSim.Framework.Lazy<List<EntityUpdate>> terseAgentUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); |
4109 | 4113 | ||
4110 | |||
4111 | // Check to see if this is a flush | 4114 | // Check to see if this is a flush |
4112 | if (maxUpdatesBytes <= 0) | 4115 | if (maxUpdatesBytes <= 0) |
4113 | { | 4116 | { |
@@ -4328,7 +4331,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4328 | ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); | 4331 | ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); |
4329 | else | 4332 | else |
4330 | ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId); | 4333 | ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId); |
4331 | objectUpdateBlocks.Value.Add(ablock); | 4334 | objectUpdateBlocks.Add(ablock); |
4332 | objectUpdates.Value.Add(update); | 4335 | objectUpdates.Value.Add(update); |
4333 | maxUpdatesBytes -= ablock.Length; | 4336 | maxUpdatesBytes -= ablock.Length; |
4334 | 4337 | ||
@@ -4337,7 +4340,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4337 | { | 4340 | { |
4338 | ObjectUpdateCompressedPacket.ObjectDataBlock ablock = | 4341 | ObjectUpdateCompressedPacket.ObjectDataBlock ablock = |
4339 | CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags); | 4342 | CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags); |
4340 | compressedUpdateBlocks.Value.Add(ablock); | 4343 | compressedUpdateBlocks.Add(ablock); |
4341 | compressedUpdates.Value.Add(update); | 4344 | compressedUpdates.Value.Add(update); |
4342 | maxUpdatesBytes -= ablock.Length; | 4345 | maxUpdatesBytes -= ablock.Length; |
4343 | } | 4346 | } |
@@ -4348,14 +4351,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4348 | { | 4351 | { |
4349 | // ALL presence updates go into a special list | 4352 | // ALL presence updates go into a special list |
4350 | ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); | 4353 | ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); |
4351 | terseAgentUpdateBlocks.Value.Add(ablock); | 4354 | terseAgentUpdateBlocks.Add(ablock); |
4352 | terseAgentUpdates.Value.Add(update); | 4355 | terseAgentUpdates.Value.Add(update); |
4353 | } | 4356 | } |
4354 | else | 4357 | else |
4355 | { | 4358 | { |
4356 | // Everything else goes here | 4359 | // Everything else goes here |
4357 | ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); | 4360 | ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); |
4358 | terseUpdateBlocks.Value.Add(ablock); | 4361 | terseUpdateBlocks.Add(ablock); |
4359 | terseUpdates.Value.Add(update); | 4362 | terseUpdates.Value.Add(update); |
4360 | } | 4363 | } |
4361 | maxUpdatesBytes -= ablock.Length; | 4364 | maxUpdatesBytes -= ablock.Length; |
@@ -4366,74 +4369,72 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4366 | 4369 | ||
4367 | #region Packet Sending | 4370 | #region Packet Sending |
4368 | 4371 | ||
4369 | // const float TIME_DILATION = 1.0f; | ||
4370 | ushort timeDilation; | 4372 | ushort timeDilation; |
4371 | // if(updatesThisCall > 0) | 4373 | |
4372 | // timeDilation = Utils.FloatToUInt16(avgTimeDilation/updatesThisCall, 0.0f, 1.0f); | 4374 | if(m_scene == null) |
4373 | // else | 4375 | return; |
4374 | // timeDilation = ushort.MaxValue; // 1.0; | ||
4375 | 4376 | ||
4376 | timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); | 4377 | timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); |
4377 | 4378 | ||
4378 | if (terseAgentUpdateBlocks.IsValueCreated) | 4379 | if (terseAgentUpdateBlocks.Count > 0) |
4379 | { | 4380 | { |
4380 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | ||
4381 | |||
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 = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 4385 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[terseAgentUpdateBlocks.Count]; |
4386 | |||
4387 | for (int i = 0; i < terseAgentUpdateBlocks.Count; i++) | ||
4388 | packet.ObjectData[i] = terseAgentUpdateBlocks[i]; | ||
4387 | 4389 | ||
4388 | for (int i = 0; i < blocks.Count; i++) | 4390 | terseAgentUpdateBlocks.Clear(); |
4389 | packet.ObjectData[i] = blocks[i]; | ||
4390 | 4391 | ||
4391 | OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); | 4392 | OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); |
4392 | } | 4393 | } |
4393 | 4394 | ||
4394 | if (objectUpdateBlocks.IsValueCreated) | 4395 | if (objectUpdateBlocks.Count > 0) |
4395 | { | 4396 | { |
4396 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; | ||
4397 | |||
4398 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | 4397 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
4399 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4398 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
4400 | packet.RegionData.TimeDilation = timeDilation; | 4399 | packet.RegionData.TimeDilation = timeDilation; |
4401 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 4400 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[objectUpdateBlocks.Count]; |
4402 | 4401 | ||
4403 | for (int i = 0; i < blocks.Count; i++) | 4402 | for (int i = 0; i < objectUpdateBlocks.Count; i++) |
4404 | packet.ObjectData[i] = blocks[i]; | 4403 | packet.ObjectData[i] = objectUpdateBlocks[i]; |
4404 | |||
4405 | objectUpdateBlocks.Clear(); | ||
4405 | 4406 | ||
4406 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); | 4407 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); |
4407 | } | 4408 | } |
4408 | 4409 | ||
4409 | if (compressedUpdateBlocks.IsValueCreated) | 4410 | if (compressedUpdateBlocks.Count > 0) |
4410 | { | 4411 | { |
4411 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
4412 | |||
4413 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | 4412 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); |
4414 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4413 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
4415 | packet.RegionData.TimeDilation = timeDilation; | 4414 | packet.RegionData.TimeDilation = timeDilation; |
4416 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | 4415 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[compressedUpdateBlocks.Count]; |
4416 | |||
4417 | for (int i = 0; i < compressedUpdateBlocks.Count; i++) | ||
4418 | packet.ObjectData[i] = compressedUpdateBlocks[i]; | ||
4417 | 4419 | ||
4418 | for (int i = 0; i < blocks.Count; i++) | 4420 | compressedUpdateBlocks.Clear(); |
4419 | packet.ObjectData[i] = blocks[i]; | ||
4420 | 4421 | ||
4421 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); | 4422 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); |
4422 | } | 4423 | } |
4423 | 4424 | ||
4424 | if (terseUpdateBlocks.IsValueCreated) | 4425 | if (terseUpdateBlocks.Count > 0) |
4425 | { | 4426 | { |
4426 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
4427 | |||
4428 | ImprovedTerseObjectUpdatePacket packet | 4427 | ImprovedTerseObjectUpdatePacket packet |
4429 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | 4428 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( |
4430 | PacketType.ImprovedTerseObjectUpdate); | 4429 | PacketType.ImprovedTerseObjectUpdate); |
4431 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4430 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
4432 | packet.RegionData.TimeDilation = timeDilation; | 4431 | packet.RegionData.TimeDilation = timeDilation; |
4433 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 4432 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[terseUpdateBlocks.Count]; |
4434 | 4433 | ||
4435 | for (int i = 0; i < blocks.Count; i++) | 4434 | for (int i = 0; i < terseUpdateBlocks.Count; i++) |
4436 | packet.ObjectData[i] = blocks[i]; | 4435 | packet.ObjectData[i] = terseUpdateBlocks[i]; |
4436 | |||
4437 | terseUpdateBlocks.Clear(); | ||
4437 | 4438 | ||
4438 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | 4439 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); |
4439 | } | 4440 | } |
@@ -4634,6 +4635,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4634 | 4635 | ||
4635 | void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories) | 4636 | void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories) |
4636 | { | 4637 | { |
4638 | if(m_scene == null) | ||
4639 | return; | ||
4640 | |||
4637 | if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) | 4641 | if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) |
4638 | { | 4642 | { |
4639 | int maxUpdateBytes = m_udpClient.GetCatBytesCanSend(ThrottleOutPacketType.Task, 30); | 4643 | int maxUpdateBytes = m_udpClient.GetCatBytesCanSend(ThrottleOutPacketType.Task, 30); |
@@ -4828,21 +4832,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4828 | m_entityProps.Enqueue(priority, new ObjectPropertyUpdate(entity,0,false,true)); | 4832 | m_entityProps.Enqueue(priority, new ObjectPropertyUpdate(entity,0,false,true)); |
4829 | } | 4833 | } |
4830 | 4834 | ||
4835 | List<ObjectPropertiesFamilyPacket.ObjectDataBlock> objectFamilyBlocks = new | ||
4836 | List<ObjectPropertiesFamilyPacket.ObjectDataBlock>(); | ||
4837 | List<ObjectPropertiesPacket.ObjectDataBlock> objectPropertiesBlocks = | ||
4838 | new List<ObjectPropertiesPacket.ObjectDataBlock>(); | ||
4839 | List<SceneObjectPart> needPhysics = new List<SceneObjectPart>(); | ||
4840 | |||
4831 | private void ProcessEntityPropertyRequests(int maxUpdateBytes) | 4841 | private void ProcessEntityPropertyRequests(int maxUpdateBytes) |
4832 | { | 4842 | { |
4833 | OpenSim.Framework.Lazy<List<ObjectPropertiesFamilyPacket.ObjectDataBlock>> objectFamilyBlocks = | 4843 | // OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> familyUpdates = |
4834 | new OpenSim.Framework.Lazy<List<ObjectPropertiesFamilyPacket.ObjectDataBlock>>(); | 4844 | // new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>(); |
4835 | |||
4836 | OpenSim.Framework.Lazy<List<ObjectPropertiesPacket.ObjectDataBlock>> objectPropertiesBlocks = | ||
4837 | new OpenSim.Framework.Lazy<List<ObjectPropertiesPacket.ObjectDataBlock>>(); | ||
4838 | 4845 | ||
4839 | OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> familyUpdates = | 4846 | // OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates = |
4840 | new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>(); | 4847 | // new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>(); |
4841 | |||
4842 | OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates = | ||
4843 | new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>(); | ||
4844 | 4848 | ||
4845 | List<SceneObjectPart> needPhysics = new List<SceneObjectPart>(); | ||
4846 | 4849 | ||
4847 | EntityUpdate iupdate; | 4850 | EntityUpdate iupdate; |
4848 | Int32 timeinqueue; // this is just debugging code & can be dropped later | 4851 | Int32 timeinqueue; // this is just debugging code & can be dropped later |
@@ -4860,8 +4863,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4860 | { | 4863 | { |
4861 | SceneObjectPart sop = (SceneObjectPart)update.Entity; | 4864 | SceneObjectPart sop = (SceneObjectPart)update.Entity; |
4862 | ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesFamilyBlock(sop,update.Flags); | 4865 | ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesFamilyBlock(sop,update.Flags); |
4863 | objectFamilyBlocks.Value.Add(objPropDB); | 4866 | objectFamilyBlocks.Add(objPropDB); |
4864 | familyUpdates.Value.Add(update); | 4867 | // familyUpdates.Value.Add(update); |
4865 | maxUpdateBytes -= objPropDB.Length; | 4868 | maxUpdateBytes -= objPropDB.Length; |
4866 | } | 4869 | } |
4867 | } | 4870 | } |
@@ -4873,23 +4876,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4873 | SceneObjectPart sop = (SceneObjectPart)update.Entity; | 4876 | SceneObjectPart sop = (SceneObjectPart)update.Entity; |
4874 | needPhysics.Add(sop); | 4877 | needPhysics.Add(sop); |
4875 | ObjectPropertiesPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesBlock(sop); | 4878 | ObjectPropertiesPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesBlock(sop); |
4876 | objectPropertiesBlocks.Value.Add(objPropDB); | 4879 | objectPropertiesBlocks.Add(objPropDB); |
4877 | propertyUpdates.Value.Add(update); | 4880 | // propertyUpdates.Value.Add(update); |
4878 | maxUpdateBytes -= objPropDB.Length; | 4881 | maxUpdateBytes -= objPropDB.Length; |
4879 | } | 4882 | } |
4880 | } | 4883 | } |
4881 | } | 4884 | } |
4882 | 4885 | ||
4883 | if (objectPropertiesBlocks.IsValueCreated) | 4886 | if (objectPropertiesBlocks.Count > 0) |
4884 | { | 4887 | { |
4885 | List<ObjectPropertiesPacket.ObjectDataBlock> blocks = objectPropertiesBlocks.Value; | ||
4886 | List<ObjectPropertyUpdate> updates = propertyUpdates.Value; | ||
4887 | |||
4888 | ObjectPropertiesPacket packet = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); | 4888 | ObjectPropertiesPacket packet = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); |
4889 | packet.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[blocks.Count]; | 4889 | packet.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[objectPropertiesBlocks.Count]; |
4890 | for (int i = 0; i < blocks.Count; i++) | 4890 | for (int i = 0; i < objectPropertiesBlocks.Count; i++) |
4891 | packet.ObjectData[i] = blocks[i]; | 4891 | packet.ObjectData[i] = objectPropertiesBlocks[i]; |
4892 | 4892 | ||
4893 | |||
4894 | objectPropertiesBlocks.Clear(); | ||
4893 | packet.Header.Zerocoded = true; | 4895 | packet.Header.Zerocoded = true; |
4894 | 4896 | ||
4895 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties | 4897 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties |
@@ -4898,7 +4900,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4898 | //OutPacket(packet, ThrottleOutPacketType.Task, true, | 4900 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4899 | // delegate(OutgoingPacket oPacket) | 4901 | // delegate(OutgoingPacket oPacket) |
4900 | // { | 4902 | // { |
4901 | // ResendPropertyUpdates(updates, oPacket); | 4903 | // ResendPropertyUpdates(propertyUpdates.Value, oPacket); |
4902 | // }); | 4904 | // }); |
4903 | OutPacket(packet, ThrottleOutPacketType.Task, true); | 4905 | OutPacket(packet, ThrottleOutPacketType.Task, true); |
4904 | 4906 | ||
@@ -4909,23 +4911,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4909 | // Int32 fpcnt = 0; | 4911 | // Int32 fpcnt = 0; |
4910 | // Int32 fbcnt = 0; | 4912 | // Int32 fbcnt = 0; |
4911 | 4913 | ||
4912 | if (objectFamilyBlocks.IsValueCreated) | 4914 | if (objectFamilyBlocks.Count > 0) |
4913 | { | 4915 | { |
4914 | List<ObjectPropertiesFamilyPacket.ObjectDataBlock> blocks = objectFamilyBlocks.Value; | ||
4915 | |||
4916 | // one packet per object block... uggh... | 4916 | // one packet per object block... uggh... |
4917 | for (int i = 0; i < blocks.Count; i++) | 4917 | for (int i = 0; i < objectFamilyBlocks.Count; i++) |
4918 | { | 4918 | { |
4919 | ObjectPropertiesFamilyPacket packet = | 4919 | ObjectPropertiesFamilyPacket packet = |
4920 | (ObjectPropertiesFamilyPacket)PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily); | 4920 | (ObjectPropertiesFamilyPacket)PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily); |
4921 | 4921 | ||
4922 | packet.ObjectData = blocks[i]; | 4922 | packet.ObjectData = objectFamilyBlocks[i]; |
4923 | packet.Header.Zerocoded = true; | 4923 | packet.Header.Zerocoded = true; |
4924 | 4924 | ||
4925 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties | 4925 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties |
4926 | // of the object rather than the properties when the packet was created | 4926 | // of the object rather than the properties when the packet was created |
4927 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); | 4927 | // List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); |
4928 | updates.Add(familyUpdates.Value[i]); | 4928 | // updates.Add(familyUpdates.Value[i]); |
4929 | // HACK : Remove intelligent resending until it's fixed in core | 4929 | // HACK : Remove intelligent resending until it's fixed in core |
4930 | //OutPacket(packet, ThrottleOutPacketType.Task, true, | 4930 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4931 | // delegate(OutgoingPacket oPacket) | 4931 | // delegate(OutgoingPacket oPacket) |
@@ -4937,6 +4937,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4937 | // fpcnt++; | 4937 | // fpcnt++; |
4938 | // fbcnt++; | 4938 | // fbcnt++; |
4939 | } | 4939 | } |
4940 | objectFamilyBlocks.Clear(); | ||
4940 | } | 4941 | } |
4941 | 4942 | ||
4942 | if(needPhysics.Count > 0) | 4943 | if(needPhysics.Count > 0) |
@@ -4962,6 +4963,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4962 | 4963 | ||
4963 | eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId); | 4964 | eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId); |
4964 | } | 4965 | } |
4966 | needPhysics.Clear(); | ||
4965 | } | 4967 | } |
4966 | 4968 | ||
4967 | // m_log.WarnFormat("[PACKETCOUNTS] queued {0} property packets with {1} blocks",ppcnt,pbcnt); | 4969 | // m_log.WarnFormat("[PACKETCOUNTS] queued {0} property packets with {1} blocks",ppcnt,pbcnt); |
@@ -6251,9 +6253,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6251 | return false; | 6253 | return false; |
6252 | } | 6254 | } |
6253 | 6255 | ||
6256 | uint seq = packet.Header.Sequence; | ||
6257 | |||
6254 | TotalAgentUpdates++; | 6258 | TotalAgentUpdates++; |
6255 | // dont let ignored updates pollute this throttles | 6259 | // dont let ignored updates pollute this throttles |
6256 | if(SceneAgent == null || SceneAgent.IsChildAgent || SceneAgent.IsInTransit) | 6260 | if(SceneAgent == null || SceneAgent.IsChildAgent || |
6261 | SceneAgent.IsInTransit || seq <= m_thisAgentUpdateArgs.lastpacketSequence ) | ||
6257 | { | 6262 | { |
6258 | // throttle reset is done at MoveAgentIntoRegion() | 6263 | // throttle reset is done at MoveAgentIntoRegion() |
6259 | // called by scenepresence on completemovement | 6264 | // called by scenepresence on completemovement |
@@ -6261,6 +6266,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6261 | return true; | 6266 | return true; |
6262 | } | 6267 | } |
6263 | 6268 | ||
6269 | m_thisAgentUpdateArgs.lastpacketSequence = seq; | ||
6270 | |||
6264 | bool movement = CheckAgentMovementUpdateSignificance(x); | 6271 | bool movement = CheckAgentMovementUpdateSignificance(x); |
6265 | bool camera = CheckAgentCameraUpdateSignificance(x); | 6272 | bool camera = CheckAgentCameraUpdateSignificance(x); |
6266 | 6273 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index d59b761..e85cee2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -120,13 +120,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
120 | /// <summary>Circuit code that this client is connected on</summary> | 120 | /// <summary>Circuit code that this client is connected on</summary> |
121 | public readonly uint CircuitCode; | 121 | public readonly uint CircuitCode; |
122 | /// <summary>Sequence numbers of packets we've received (for duplicate checking)</summary> | 122 | /// <summary>Sequence numbers of packets we've received (for duplicate checking)</summary> |
123 | public readonly IncomingPacketHistoryCollection PacketArchive = new IncomingPacketHistoryCollection(200); | 123 | public IncomingPacketHistoryCollection PacketArchive = new IncomingPacketHistoryCollection(200); |
124 | 124 | ||
125 | /// <summary>Packets we have sent that need to be ACKed by the client</summary> | 125 | /// <summary>Packets we have sent that need to be ACKed by the client</summary> |
126 | public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); | 126 | public UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); |
127 | 127 | ||
128 | /// <summary>ACKs that are queued up, waiting to be sent to the client</summary> | 128 | /// <summary>ACKs that are queued up, waiting to be sent to the client</summary> |
129 | public readonly DoubleLocklessQueue<uint> PendingAcks = new DoubleLocklessQueue<uint>(); | 129 | public DoubleLocklessQueue<uint> PendingAcks = new DoubleLocklessQueue<uint>(); |
130 | 130 | ||
131 | /// <summary>Current packet sequence number</summary> | 131 | /// <summary>Current packet sequence number</summary> |
132 | public int CurrentSequence; | 132 | public int CurrentSequence; |
@@ -170,7 +170,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
170 | private double m_nextOnQueueEmpty = 0; | 170 | private double m_nextOnQueueEmpty = 0; |
171 | 171 | ||
172 | /// <summary>Throttle bucket for this agent's connection</summary> | 172 | /// <summary>Throttle bucket for this agent's connection</summary> |
173 | private readonly AdaptiveTokenBucket m_throttleClient; | 173 | private AdaptiveTokenBucket m_throttleClient; |
174 | public AdaptiveTokenBucket FlowThrottle | 174 | public AdaptiveTokenBucket FlowThrottle |
175 | { | 175 | { |
176 | get { return m_throttleClient; } | 176 | get { return m_throttleClient; } |
@@ -179,10 +179,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
179 | /// <summary>Throttle buckets for each packet category</summary> | 179 | /// <summary>Throttle buckets for each packet category</summary> |
180 | private readonly TokenBucket[] m_throttleCategories; | 180 | private readonly TokenBucket[] m_throttleCategories; |
181 | /// <summary>Outgoing queues for throttled packets</summary> | 181 | /// <summary>Outgoing queues for throttled packets</summary> |
182 | private readonly DoubleLocklessQueue<OutgoingPacket>[] m_packetOutboxes = new DoubleLocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT]; | 182 | private DoubleLocklessQueue<OutgoingPacket>[] m_packetOutboxes = new DoubleLocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT]; |
183 | /// <summary>A container that can hold one packet for each outbox, used to store | 183 | /// <summary>A container that can hold one packet for each outbox, used to store |
184 | /// dequeued packets that are being held for throttling</summary> | 184 | /// dequeued packets that are being held for throttling</summary> |
185 | private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT]; | 185 | private OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT]; |
186 | /// <summary>A reference to the LLUDPServer that is managing this client</summary> | 186 | /// <summary>A reference to the LLUDPServer that is managing this client</summary> |
187 | private readonly LLUDPServer m_udpServer; | 187 | private readonly LLUDPServer m_udpServer; |
188 | 188 | ||
@@ -288,14 +288,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
288 | for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) | 288 | for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) |
289 | { | 289 | { |
290 | m_packetOutboxes[i].Clear(); | 290 | m_packetOutboxes[i].Clear(); |
291 | m_throttleCategories[i] = null; | ||
291 | m_nextPackets[i] = null; | 292 | m_nextPackets[i] = null; |
292 | } | 293 | } |
293 | 294 | ||
294 | // pull the throttle out of the scene throttle | 295 | // pull the throttle out of the scene throttle |
295 | m_throttleClient.Parent.UnregisterRequest(m_throttleClient); | 296 | m_throttleClient.Parent.UnregisterRequest(m_throttleClient); |
297 | m_throttleClient = null; | ||
296 | OnPacketStats = null; | 298 | OnPacketStats = null; |
297 | OnQueueEmpty = null; | 299 | OnQueueEmpty = null; |
298 | } | 300 | PendingAcks.Clear(); |
301 | NeedAcks.Clear(); | ||
302 | NeedAcks = null; | ||
303 | PendingAcks = null; | ||
304 | m_nextPackets = null; | ||
305 | m_packetOutboxes = null; | ||
306 | } | ||
299 | 307 | ||
300 | /// <summary> | 308 | /// <summary> |
301 | /// Gets information about this client connection | 309 | /// Gets information about this client connection |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index ffdb639..af33d17 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -326,7 +326,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
326 | protected double m_tickLastOutgoingPacketHandler; | 326 | protected double m_tickLastOutgoingPacketHandler; |
327 | 327 | ||
328 | /// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary> | 328 | /// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary> |
329 | protected int m_elapsedMSOutgoingPacketHandler; | 329 | protected double m_elapsedMSOutgoingPacketHandler; |
330 | 330 | ||
331 | /// <summary>Keeps track of the number of 100 millisecond periods elapsed in the outgoing packet handler executed</summary> | 331 | /// <summary>Keeps track of the number of 100 millisecond periods elapsed in the outgoing packet handler executed</summary> |
332 | protected int m_elapsed100MSOutgoingPacketHandler; | 332 | protected int m_elapsed100MSOutgoingPacketHandler; |
@@ -2074,18 +2074,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2074 | 2074 | ||
2075 | // Update elapsed time | 2075 | // Update elapsed time |
2076 | double thisTick = Util.GetTimeStampMS(); | 2076 | double thisTick = Util.GetTimeStampMS(); |
2077 | int deltaMS = (int)(thisTick - m_tickLastOutgoingPacketHandler); | ||
2078 | m_tickLastOutgoingPacketHandler = thisTick; | ||
2079 | 2077 | ||
2080 | // update some 1ms resolution chained timers | 2078 | // update some 1ms resolution chained timers |
2081 | 2079 | m_elapsedMSOutgoingPacketHandler += thisTick - m_tickLastOutgoingPacketHandler; | |
2082 | m_elapsedMSOutgoingPacketHandler += deltaMS; | 2080 | m_tickLastOutgoingPacketHandler = thisTick; |
2083 | 2081 | ||
2084 | // Check for pending outgoing resends every 100ms | 2082 | // Check for pending outgoing resends every 100ms |
2085 | if (m_elapsedMSOutgoingPacketHandler >= 100) | 2083 | if (m_elapsedMSOutgoingPacketHandler >= 100.0) |
2086 | { | 2084 | { |
2087 | m_resendUnacked = true; | 2085 | m_resendUnacked = true; |
2088 | m_elapsedMSOutgoingPacketHandler = 0; | 2086 | m_elapsedMSOutgoingPacketHandler = 0.0; |
2089 | m_elapsed100MSOutgoingPacketHandler += 1; | 2087 | m_elapsed100MSOutgoingPacketHandler += 1; |
2090 | } | 2088 | } |
2091 | 2089 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 7b9661b..d4603f8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | |||
@@ -193,7 +193,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
193 | Parent = parent; | 193 | Parent = parent; |
194 | RequestedDripRate = dripRate; | 194 | RequestedDripRate = dripRate; |
195 | RequestedBurst = MaxBurst; | 195 | RequestedBurst = MaxBurst; |
196 | m_lastDrip = Util.GetTimeStampMS() + 50.0; | 196 | m_lastDrip = Util.GetTimeStampMS() + 100000.0; // skip first drip |
197 | } | 197 | } |
198 | 198 | ||
199 | #endregion Constructor | 199 | #endregion Constructor |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs index b546a99..c9d5697 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs | |||
@@ -74,6 +74,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
74 | /// <summary>Holds information about pending removals</summary> | 74 | /// <summary>Holds information about pending removals</summary> |
75 | private LocklessQueue<uint> m_pendingRemoves = new LocklessQueue<uint>(); | 75 | private LocklessQueue<uint> m_pendingRemoves = new LocklessQueue<uint>(); |
76 | 76 | ||
77 | |||
78 | public void Clear() | ||
79 | { | ||
80 | m_packets.Clear(); | ||
81 | m_pendingAdds = null; | ||
82 | m_pendingAcknowledgements = null; | ||
83 | m_pendingRemoves = null; | ||
84 | } | ||
85 | |||
77 | /// <summary> | 86 | /// <summary> |
78 | /// Add an unacked packet to the collection | 87 | /// Add an unacked packet to the collection |
79 | /// </summary> | 88 | /// </summary> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index 6c1cc52..2afd74e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | |||
@@ -36,6 +36,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
36 | { | 36 | { |
37 | public class UserAccountCache : IUserAccountCacheModule | 37 | public class UserAccountCache : IUserAccountCacheModule |
38 | { | 38 | { |
39 | private const double CACHE_ALIEN_EXPIRATION_SECONDS = 172800; // 48 hours | ||
39 | private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour! | 40 | private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour! |
40 | private const double CACHE_NULL_EXPIRATION_SECONDS = 600; // 10minutes | 41 | private const double CACHE_NULL_EXPIRATION_SECONDS = 600; // 10minutes |
41 | 42 | ||
@@ -60,21 +61,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
60 | { | 61 | { |
61 | if (account == null) | 62 | if (account == null) |
62 | m_UUIDCache.AddOrUpdate(userID, null, CACHE_NULL_EXPIRATION_SECONDS); | 63 | m_UUIDCache.AddOrUpdate(userID, null, CACHE_NULL_EXPIRATION_SECONDS); |
63 | else | 64 | else if(account.LocalToGrid) |
64 | { | 65 | { |
65 | m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS); | 66 | m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS); |
66 | m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); | 67 | m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); |
67 | } | 68 | } |
68 | 69 | else | |
70 | { | ||
71 | m_UUIDCache.AddOrUpdate(userID, account, CACHE_ALIEN_EXPIRATION_SECONDS); | ||
72 | m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_ALIEN_EXPIRATION_SECONDS); | ||
73 | } | ||
69 | //m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); | 74 | //m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); |
70 | } | 75 | } |
71 | } | 76 | } |
72 | 77 | ||
73 | public void Invalidate(UUID userID) | ||
74 | { | ||
75 | lock(accessLock) | ||
76 | m_UUIDCache.Remove(userID); | ||
77 | } | ||
78 | 78 | ||
79 | public UserAccount Get(UUID userID, out bool inCache) | 79 | public UserAccount Get(UUID userID, out bool inCache) |
80 | { | 80 | { |
@@ -114,6 +114,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
114 | return null; | 114 | return null; |
115 | } | 115 | } |
116 | 116 | ||
117 | public void Invalidate(UUID userID) | ||
118 | { | ||
119 | m_UUIDCache.Remove(userID); | ||
120 | } | ||
121 | |||
122 | public void Remove(UUID id) | ||
123 | { | ||
124 | lock(accessLock) | ||
125 | { | ||
126 | if (!m_UUIDCache.Contains(id)) | ||
127 | return; | ||
128 | |||
129 | UserAccount account = null; | ||
130 | if (m_UUIDCache.TryGetValue(id, out account) && account != null) | ||
131 | m_NameCache.Remove(account.Name); | ||
132 | m_UUIDCache.Remove(id); | ||
133 | } | ||
134 | } | ||
135 | |||
117 | public void Remove(string name) | 136 | public void Remove(string name) |
118 | { | 137 | { |
119 | lock(accessLock) | 138 | lock(accessLock) |
diff --git a/OpenSim/Region/Framework/Interfaces/IUserAccountCacheModule.cs b/OpenSim/Region/Framework/Interfaces/IUserAccountCacheModule.cs index ed26989..027a7e2 100644 --- a/OpenSim/Region/Framework/Interfaces/IUserAccountCacheModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IUserAccountCacheModule.cs | |||
@@ -26,8 +26,10 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenSim.Region.Framework.Scenes; | 28 | using OpenSim.Region.Framework.Scenes; |
29 | using OpenMetaverse; | ||
29 | 30 | ||
30 | public interface IUserAccountCacheModule | 31 | public interface IUserAccountCacheModule |
31 | { | 32 | { |
32 | void Remove(string name); | 33 | void Remove(string name); |
34 | void Remove(UUID id); | ||
33 | } | 35 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ca32940..c349369 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4141,7 +4141,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4141 | { | 4141 | { |
4142 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); | 4142 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
4143 | if (cache != null) | 4143 | if (cache != null) |
4144 | cache.Remove(acd.firstname + " " + acd.lastname); | 4144 | // cache.Remove(acd.firstname + " " + acd.lastname); |
4145 | cache.Remove(acd.AgentID); | ||
4145 | 4146 | ||
4146 | // Remove any preexisting circuit - we don't want duplicates | 4147 | // Remove any preexisting circuit - we don't want duplicates |
4147 | // This is a stab at preventing avatar "ghosting" | 4148 | // This is a stab at preventing avatar "ghosting" |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3378ead..2cfdd94 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1104,7 +1104,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1104 | 1104 | ||
1105 | AdjustKnownSeeds(); | 1105 | AdjustKnownSeeds(); |
1106 | 1106 | ||
1107 | RegisterToEvents(); | 1107 | RegisterToClientEvents(); |
1108 | SetDirectionVectors(); | 1108 | SetDirectionVectors(); |
1109 | 1109 | ||
1110 | Appearance = appearance; | 1110 | Appearance = appearance; |
@@ -1171,7 +1171,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1171 | } | 1171 | } |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | public void RegisterToEvents() | 1174 | public void RegisterToClientEvents() |
1175 | { | 1175 | { |
1176 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; | 1176 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; |
1177 | ControllingClient.OnAgentUpdate += HandleAgentUpdate; | 1177 | ControllingClient.OnAgentUpdate += HandleAgentUpdate; |
@@ -1189,6 +1189,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1189 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | 1189 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); |
1190 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | 1190 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); |
1191 | } | 1191 | } |
1192 | |||
1193 | public void RemoveClientEvents() | ||
1194 | { | ||
1195 | ControllingClient.OnCompleteMovementToRegion -= CompleteMovement; | ||
1196 | ControllingClient.OnAgentUpdate -= HandleAgentUpdate; | ||
1197 | ControllingClient.OnAgentCameraUpdate -= HandleAgentCamerasUpdate; | ||
1198 | ControllingClient.OnAgentRequestSit -= HandleAgentRequestSit; | ||
1199 | ControllingClient.OnAgentSit -= HandleAgentSit; | ||
1200 | ControllingClient.OnSetAlwaysRun -= HandleSetAlwaysRun; | ||
1201 | ControllingClient.OnStartAnim -= HandleStartAnim; | ||
1202 | ControllingClient.OnStopAnim -= HandleStopAnim; | ||
1203 | ControllingClient.OnChangeAnim -= avnHandleChangeAnim; | ||
1204 | ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; | ||
1205 | ControllingClient.OnAutoPilotGo -= MoveToTarget; | ||
1206 | ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; | ||
1207 | } | ||
1192 | 1208 | ||
1193 | private void SetDirectionVectors() | 1209 | private void SetDirectionVectors() |
1194 | { | 1210 | { |
@@ -2318,7 +2334,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2318 | Vector3 tocam = CameraPosition - posAdjusted; | 2334 | Vector3 tocam = CameraPosition - posAdjusted; |
2319 | 2335 | ||
2320 | float distTocamlen = tocam.LengthSquared(); | 2336 | float distTocamlen = tocam.LengthSquared(); |
2321 | if (distTocamlen > 0.08f && distTocamlen < 400) | 2337 | if (distTocamlen > 0.01f && distTocamlen < 400) |
2322 | { | 2338 | { |
2323 | distTocamlen = (float)Math.Sqrt(distTocamlen); | 2339 | distTocamlen = (float)Math.Sqrt(distTocamlen); |
2324 | tocam *= (1.0f / distTocamlen); | 2340 | tocam *= (1.0f / distTocamlen); |
@@ -4378,16 +4394,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
4378 | m_log.DebugFormat( | 4394 | m_log.DebugFormat( |
4379 | "[SCENE PRESENCE]: Closing child agents. Checking {0} regions in {1}", | 4395 | "[SCENE PRESENCE]: Closing child agents. Checking {0} regions in {1}", |
4380 | knownRegions.Count, Scene.RegionInfo.RegionName); | 4396 | knownRegions.Count, Scene.RegionInfo.RegionName); |
4381 | //DumpKnownRegions(); | ||
4382 | 4397 | ||
4383 | Util.RegionHandleToRegionLoc(newRegionHandle, out newRegionX, out newRegionY); | 4398 | Util.RegionHandleToRegionLoc(newRegionHandle, out newRegionX, out newRegionY); |
4384 | 4399 | ||
4385 | uint x, y; | 4400 | uint x, y; |
4386 | spRegionSizeInfo regInfo; | 4401 | spRegionSizeInfo regInfo; |
4387 | 4402 | ||
4388 | // this should not be here | ||
4389 | IEventQueue eventQueue = Scene.RequestModuleInterface<IEventQueue>(); | ||
4390 | |||
4391 | foreach (ulong handle in knownRegions) | 4403 | foreach (ulong handle in knownRegions) |
4392 | { | 4404 | { |
4393 | // Don't close the agent on this region yet | 4405 | // Don't close the agent on this region yet |
@@ -4400,16 +4412,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4400 | Util.RegionHandleToRegionLoc(handle, out x, out y); | 4412 | Util.RegionHandleToRegionLoc(handle, out x, out y); |
4401 | if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) | 4413 | if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) |
4402 | { | 4414 | { |
4403 | |||
4404 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | ||
4405 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | ||
4406 | if (Util.IsOutsideView(RegionViewDistance, x, newRegionX, y, newRegionY, | 4415 | if (Util.IsOutsideView(RegionViewDistance, x, newRegionX, y, newRegionY, |
4407 | regInfo.sizeX, regInfo.sizeY, newRegionSizeX, newRegionSizeY)) | 4416 | regInfo.sizeX, regInfo.sizeY, newRegionSizeX, newRegionSizeY)) |
4408 | { | 4417 | { |
4409 | byebyeRegions.Add(handle); | 4418 | byebyeRegions.Add(handle); |
4410 | // this should not be here | ||
4411 | // if(eventQueue != null) | ||
4412 | /// eventQueue.DisableSimulator(handle,UUID); | ||
4413 | } | 4419 | } |
4414 | } | 4420 | } |
4415 | else | 4421 | else |
@@ -4445,6 +4451,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
4445 | } | 4451 | } |
4446 | } | 4452 | } |
4447 | 4453 | ||
4454 | public void closeAllChildAgents() | ||
4455 | { | ||
4456 | List<ulong> byebyeRegions = new List<ulong>(); | ||
4457 | List<ulong> knownRegions = KnownRegionHandles; | ||
4458 | foreach (ulong handle in knownRegions) | ||
4459 | { | ||
4460 | if (handle != Scene.RegionInfo.RegionHandle) | ||
4461 | { | ||
4462 | byebyeRegions.Add(handle); | ||
4463 | RemoveNeighbourRegion(handle); | ||
4464 | Scene.CapsModule.DropChildSeed(UUID, handle); | ||
4465 | } | ||
4466 | } | ||
4467 | |||
4468 | if (byebyeRegions.Count > 0) | ||
4469 | { | ||
4470 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); | ||
4471 | |||
4472 | AgentCircuitData acd = Scene.AuthenticateHandler.GetAgentCircuitData(UUID); | ||
4473 | string auth = string.Empty; | ||
4474 | if (acd != null) | ||
4475 | auth = acd.SessionID.ToString(); | ||
4476 | m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, auth, byebyeRegions); | ||
4477 | } | ||
4478 | } | ||
4479 | |||
4448 | #endregion | 4480 | #endregion |
4449 | 4481 | ||
4450 | /// <summary> | 4482 | /// <summary> |
@@ -5000,12 +5032,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
5000 | RemoveFromPhysicalScene(); | 5032 | RemoveFromPhysicalScene(); |
5001 | 5033 | ||
5002 | m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; | 5034 | m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; |
5035 | RemoveClientEvents(); | ||
5003 | 5036 | ||
5004 | // if (Animator != null) | 5037 | // if (Animator != null) |
5005 | // Animator.Close(); | 5038 | // Animator.Close(); |
5006 | Animator = null; | 5039 | Animator = null; |
5007 | 5040 | ||
5041 | scriptedcontrols.Clear(); | ||
5042 | ControllingClient = null; | ||
5008 | LifecycleState = ScenePresenceState.Removed; | 5043 | LifecycleState = ScenePresenceState.Removed; |
5044 | IsDeleted = true; | ||
5009 | } | 5045 | } |
5010 | 5046 | ||
5011 | public void AddAttachment(SceneObjectGroup gobj) | 5047 | public void AddAttachment(SceneObjectGroup gobj) |
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs index d9ea4a4..0cdaa60 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs | |||
@@ -39,6 +39,24 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
39 | { | 39 | { |
40 | public class MeshBuildingData | 40 | public class MeshBuildingData |
41 | { | 41 | { |
42 | private class vertexcomp : IEqualityComparer<Vertex> | ||
43 | { | ||
44 | public bool Equals(Vertex v1, Vertex v2) | ||
45 | { | ||
46 | if (v1.X == v2.X && v1.Y == v2.Y && v1.Z == v2.Z) | ||
47 | return true; | ||
48 | else | ||
49 | return false; | ||
50 | } | ||
51 | public int GetHashCode(Vertex v) | ||
52 | { | ||
53 | int a = v.X.GetHashCode(); | ||
54 | int b = v.Y.GetHashCode(); | ||
55 | int c = v.Z.GetHashCode(); | ||
56 | return (a << 16) ^ (b << 8) ^ c; | ||
57 | } | ||
58 | } | ||
59 | |||
42 | public Dictionary<Vertex, int> m_vertices; | 60 | public Dictionary<Vertex, int> m_vertices; |
43 | public List<Triangle> m_triangles; | 61 | public List<Triangle> m_triangles; |
44 | public float m_obbXmin; | 62 | public float m_obbXmin; |
@@ -49,6 +67,21 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
49 | public float m_obbZmax; | 67 | public float m_obbZmax; |
50 | public Vector3 m_centroid; | 68 | public Vector3 m_centroid; |
51 | public int m_centroidDiv; | 69 | public int m_centroidDiv; |
70 | |||
71 | public MeshBuildingData() | ||
72 | { | ||
73 | vertexcomp vcomp = new vertexcomp(); | ||
74 | m_vertices = new Dictionary<Vertex, int>(vcomp); | ||
75 | m_triangles = new List<Triangle>(); | ||
76 | m_centroid = Vector3.Zero; | ||
77 | m_centroidDiv = 0; | ||
78 | m_obbXmin = float.MaxValue; | ||
79 | m_obbXmax = float.MinValue; | ||
80 | m_obbYmin = float.MaxValue; | ||
81 | m_obbYmax = float.MinValue; | ||
82 | m_obbZmin = float.MaxValue; | ||
83 | m_obbZmax = float.MinValue; | ||
84 | } | ||
52 | } | 85 | } |
53 | 86 | ||
54 | [Serializable()] | 87 | [Serializable()] |
@@ -76,50 +109,20 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
76 | public int RefCount { get; set; } | 109 | public int RefCount { get; set; } |
77 | public AMeshKey Key { get; set; } | 110 | public AMeshKey Key { get; set; } |
78 | 111 | ||
79 | private class vertexcomp : IEqualityComparer<Vertex> | 112 | public Mesh(bool forbuild) |
80 | { | 113 | { |
81 | public bool Equals(Vertex v1, Vertex v2) | 114 | if(forbuild) |
82 | { | 115 | m_bdata = new MeshBuildingData(); |
83 | if (v1.X == v2.X && v1.Y == v2.Y && v1.Z == v2.Z) | ||
84 | return true; | ||
85 | else | ||
86 | return false; | ||
87 | } | ||
88 | public int GetHashCode(Vertex v) | ||
89 | { | ||
90 | int a = v.X.GetHashCode(); | ||
91 | int b = v.Y.GetHashCode(); | ||
92 | int c = v.Z.GetHashCode(); | ||
93 | return (a << 16) ^ (b << 8) ^ c; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | public Mesh() | ||
98 | { | ||
99 | vertexcomp vcomp = new vertexcomp(); | ||
100 | |||
101 | m_bdata = new MeshBuildingData(); | ||
102 | m_bdata.m_vertices = new Dictionary<Vertex, int>(vcomp); | ||
103 | m_bdata.m_triangles = new List<Triangle>(); | ||
104 | m_bdata.m_centroid = Vector3.Zero; | ||
105 | m_bdata.m_centroidDiv = 0; | ||
106 | m_bdata.m_obbXmin = float.MaxValue; | ||
107 | m_bdata.m_obbXmax = float.MinValue; | ||
108 | m_bdata.m_obbYmin = float.MaxValue; | ||
109 | m_bdata.m_obbYmax = float.MinValue; | ||
110 | m_bdata.m_obbZmin = float.MaxValue; | ||
111 | m_bdata.m_obbZmax = float.MinValue; | ||
112 | m_obb = new Vector3(0.5f, 0.5f, 0.5f); | 116 | m_obb = new Vector3(0.5f, 0.5f, 0.5f); |
113 | m_obboffset = Vector3.Zero; | 117 | m_obboffset = Vector3.Zero; |
114 | } | 118 | } |
115 | 119 | ||
116 | |||
117 | public Mesh Scale(Vector3 scale) | 120 | public Mesh Scale(Vector3 scale) |
118 | { | 121 | { |
119 | if (m_verticesPtr == null || m_indicesPtr == null) | 122 | if (m_verticesPtr == null || m_indicesPtr == null) |
120 | return null; | 123 | return null; |
121 | 124 | ||
122 | Mesh result = new Mesh(); | 125 | Mesh result = new Mesh(false); |
123 | 126 | ||
124 | float x = scale.X; | 127 | float x = scale.X; |
125 | float y = scale.Y; | 128 | float y = scale.Y; |
@@ -167,7 +170,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
167 | 170 | ||
168 | public Mesh Clone() | 171 | public Mesh Clone() |
169 | { | 172 | { |
170 | Mesh result = new Mesh(); | 173 | Mesh result = new Mesh(false); |
171 | 174 | ||
172 | if (m_bdata != null) | 175 | if (m_bdata != null) |
173 | { | 176 | { |
@@ -514,8 +517,6 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
514 | if (m_indicesPtr == IntPtr.Zero) | 517 | if (m_indicesPtr == IntPtr.Zero) |
515 | indexes = getIndexListAsInt(); | 518 | indexes = getIndexListAsInt(); |
516 | 519 | ||
517 | pinMemory(); | ||
518 | |||
519 | float x, y, z; | 520 | float x, y, z; |
520 | 521 | ||
521 | if (m_bdata.m_centroidDiv > 0) | 522 | if (m_bdata.m_centroidDiv > 0) |
@@ -543,55 +544,53 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
543 | m_obb = new Vector3(x, y, z); | 544 | m_obb = new Vector3(x, y, z); |
544 | 545 | ||
545 | releaseBuildingMeshData(); | 546 | releaseBuildingMeshData(); |
547 | pinMemory(); | ||
546 | } | 548 | } |
549 | |||
547 | public bool ToStream(Stream st) | 550 | public bool ToStream(Stream st) |
548 | { | 551 | { |
549 | if (m_indicesPtr == IntPtr.Zero || m_verticesPtr == IntPtr.Zero) | 552 | if (m_indicesPtr == IntPtr.Zero || m_verticesPtr == IntPtr.Zero) |
550 | return false; | 553 | return false; |
551 | 554 | ||
552 | BinaryWriter bw = new BinaryWriter(st); | ||
553 | bool ok = true; | 555 | bool ok = true; |
554 | 556 | ||
555 | try | 557 | try |
556 | { | 558 | { |
557 | 559 | using(BinaryWriter bw = new BinaryWriter(st)) | |
558 | bw.Write(m_vertexCount); | 560 | { |
559 | bw.Write(m_indexCount); | 561 | bw.Write(m_vertexCount); |
560 | 562 | bw.Write(m_indexCount); | |
561 | for (int i = 0; i < 3 * m_vertexCount; i++) | 563 | |
562 | bw.Write(vertices[i]); | 564 | for (int i = 0; i < 3 * m_vertexCount; i++) |
563 | for (int i = 0; i < m_indexCount; i++) | 565 | bw.Write(vertices[i]); |
564 | bw.Write(indexes[i]); | 566 | for (int i = 0; i < m_indexCount; i++) |
565 | bw.Write(m_obb.X); | 567 | bw.Write(indexes[i]); |
566 | bw.Write(m_obb.Y); | 568 | bw.Write(m_obb.X); |
567 | bw.Write(m_obb.Z); | 569 | bw.Write(m_obb.Y); |
568 | bw.Write(m_obboffset.X); | 570 | bw.Write(m_obb.Z); |
569 | bw.Write(m_obboffset.Y); | 571 | bw.Write(m_obboffset.X); |
570 | bw.Write(m_obboffset.Z); | 572 | bw.Write(m_obboffset.Y); |
573 | bw.Write(m_obboffset.Z); | ||
574 | bw.Flush(); | ||
575 | bw.Close(); | ||
576 | } | ||
571 | } | 577 | } |
572 | catch | 578 | catch |
573 | { | 579 | { |
574 | ok = false; | 580 | ok = false; |
575 | } | 581 | } |
576 | 582 | ||
577 | if (bw != null) | ||
578 | { | ||
579 | bw.Flush(); | ||
580 | bw.Close(); | ||
581 | } | ||
582 | |||
583 | return ok; | 583 | return ok; |
584 | } | 584 | } |
585 | 585 | ||
586 | public static Mesh FromStream(Stream st, AMeshKey key) | 586 | public static Mesh FromStream(Stream st, AMeshKey key) |
587 | { | 587 | { |
588 | Mesh mesh = new Mesh(); | 588 | Mesh mesh = new Mesh(false); |
589 | mesh.releaseBuildingMeshData(); | ||
590 | 589 | ||
591 | bool ok = true; | 590 | bool ok = true; |
592 | using(BinaryReader br = new BinaryReader(st)) | 591 | try |
593 | { | 592 | { |
594 | try | 593 | using(BinaryReader br = new BinaryReader(st)) |
595 | { | 594 | { |
596 | mesh.m_vertexCount = br.ReadInt32(); | 595 | mesh.m_vertexCount = br.ReadInt32(); |
597 | mesh.m_indexCount = br.ReadInt32(); | 596 | mesh.m_indexCount = br.ReadInt32(); |
@@ -613,10 +612,10 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
613 | mesh.m_obboffset.Y = br.ReadSingle(); | 612 | mesh.m_obboffset.Y = br.ReadSingle(); |
614 | mesh.m_obboffset.Z = br.ReadSingle(); | 613 | mesh.m_obboffset.Z = br.ReadSingle(); |
615 | } | 614 | } |
616 | catch | 615 | } |
617 | { | 616 | catch |
618 | ok = false; | 617 | { |
619 | } | 618 | ok = false; |
620 | } | 619 | } |
621 | 620 | ||
622 | if (ok) | 621 | if (ok) |
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs index ca94034..2ae0881 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | |||
@@ -182,7 +182,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
182 | /// <returns></returns> | 182 | /// <returns></returns> |
183 | private static Mesh CreateSimpleBoxMesh(float minX, float maxX, float minY, float maxY, float minZ, float maxZ) | 183 | private static Mesh CreateSimpleBoxMesh(float minX, float maxX, float minY, float maxY, float minZ, float maxZ) |
184 | { | 184 | { |
185 | Mesh box = new Mesh(); | 185 | Mesh box = new Mesh(true); |
186 | List<Vertex> vertices = new List<Vertex>(); | 186 | List<Vertex> vertices = new List<Vertex>(); |
187 | // bottom | 187 | // bottom |
188 | 188 | ||
@@ -357,7 +357,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
357 | int numCoords = coords.Count; | 357 | int numCoords = coords.Count; |
358 | int numFaces = faces.Count; | 358 | int numFaces = faces.Count; |
359 | 359 | ||
360 | Mesh mesh = new Mesh(); | 360 | Mesh mesh = new Mesh(true); |
361 | // Add the corresponding triangles to the mesh | 361 | // Add the corresponding triangles to the mesh |
362 | for (int i = 0; i < numFaces; i++) | 362 | for (int i = 0; i < numFaces; i++) |
363 | { | 363 | { |
@@ -1483,6 +1483,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1483 | 1483 | ||
1484 | lock (diskLock) | 1484 | lock (diskLock) |
1485 | { | 1485 | { |
1486 | Stream stream = null; | ||
1486 | try | 1487 | try |
1487 | { | 1488 | { |
1488 | if (!Directory.Exists(dir)) | 1489 | if (!Directory.Exists(dir)) |
@@ -1490,8 +1491,8 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1490 | Directory.CreateDirectory(dir); | 1491 | Directory.CreateDirectory(dir); |
1491 | } | 1492 | } |
1492 | 1493 | ||
1493 | using(Stream stream = File.Open(filename, FileMode.Create)) | 1494 | stream = File.Open(filename, FileMode.Create); |
1494 | ok = mesh.ToStream(stream); | 1495 | ok = mesh.ToStream(stream); |
1495 | } | 1496 | } |
1496 | catch (IOException e) | 1497 | catch (IOException e) |
1497 | { | 1498 | { |
@@ -1500,6 +1501,11 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1500 | filename, e.Message, e.StackTrace); | 1501 | filename, e.Message, e.StackTrace); |
1501 | ok = false; | 1502 | ok = false; |
1502 | } | 1503 | } |
1504 | finally | ||
1505 | { | ||
1506 | if(stream != null) | ||
1507 | stream.Dispose(); | ||
1508 | } | ||
1503 | 1509 | ||
1504 | if (!ok && File.Exists(filename)) | 1510 | if (!ok && File.Exists(filename)) |
1505 | { | 1511 | { |