aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs47
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs35
2 files changed, 62 insertions, 20 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 960e0a2..7e85396 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -348,6 +348,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
348 protected PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates; 348 protected PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates;
349 private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates; 349 private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates;
350 private PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates; 350 private PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates;
351
352 /// <value>
353 /// List used in construction of data blocks for an object update packet. This is to stop us having to
354 /// continually recreate it.
355 /// </value>
356 protected List<ObjectUpdatePacket.ObjectDataBlock> m_fullUpdateDataBlocksBuilder;
357
358 /// <value>
359 /// Maintain a record of all the objects killed. This allows us to stop an update being sent from the
360 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
361 /// ownerless phantom.
362 ///
363 /// All manipulation of this set has to occur under a m_primFullUpdate.SyncRoot lock
364 ///
365 /// </value>
366 protected HashSet<uint> m_killRecord;
367
351 private int m_moneyBalance; 368 private int m_moneyBalance;
352 private int m_animationSequenceNumber = 1; 369 private int m_animationSequenceNumber = 1;
353 private bool m_SendLogoutPacketWhenClosing = true; 370 private bool m_SendLogoutPacketWhenClosing = true;
@@ -437,6 +454,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
437 m_avatarTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); 454 m_avatarTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
438 m_primTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); 455 m_primTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
439 m_primFullUpdates = new PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock>(m_scene.Entities.Count); 456 m_primFullUpdates = new PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock>(m_scene.Entities.Count);
457 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
458 m_killRecord = new HashSet<uint>();
440 459
441 m_assetService = m_scene.RequestModuleInterface<IAssetService>(); 460 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
442 m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>(); 461 m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
@@ -1473,7 +1492,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1473 kill.ObjectData[0].ID = localID; 1492 kill.ObjectData[0].ID = localID;
1474 kill.Header.Reliable = true; 1493 kill.Header.Reliable = true;
1475 kill.Header.Zerocoded = true; 1494 kill.Header.Zerocoded = true;
1476 OutPacket(kill, ThrottleOutPacketType.State); 1495
1496 lock (m_primFullUpdates.SyncRoot)
1497 {
1498 m_killRecord.Add(localID);
1499 OutPacket(kill, ThrottleOutPacketType.State);
1500 }
1477 } 1501 }
1478 1502
1479 /// <summary> 1503 /// <summary>
@@ -3513,21 +3537,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3513 if (count == 0) 3537 if (count == 0)
3514 return; 3538 return;
3515 3539
3516 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count]; 3540 m_fullUpdateDataBlocksBuilder.Clear();
3541
3517 for (int i = 0; i < count; i++) 3542 for (int i = 0; i < count; i++)
3518 { 3543 {
3519 outPacket.ObjectData[i] = m_primFullUpdates.Dequeue(); 3544 ObjectUpdatePacket.ObjectDataBlock block = m_primFullUpdates.Dequeue();
3520 3545
3546 if (!m_killRecord.Contains(block.ID))
3547 {
3548 m_fullUpdateDataBlocksBuilder.Add(block);
3549
3521// string text = Util.FieldToString(outPacket.ObjectData[i].Text); 3550// string text = Util.FieldToString(outPacket.ObjectData[i].Text);
3522// if (text.IndexOf("\n") >= 0) 3551// if (text.IndexOf("\n") >= 0)
3523// text = text.Remove(text.IndexOf("\n")); 3552// text = text.Remove(text.IndexOf("\n"));
3524// m_log.DebugFormat( 3553// m_log.DebugFormat(
3525// "[CLIENT]: Sending full info about prim {0} text {1} to client {2}", 3554// "[CLIENT]: Sending full info about prim {0} text {1} to client {2}",
3526// outPacket.ObjectData[i].ID, text, Name); 3555// outPacket.ObjectData[i].ID, text, Name);
3556 }
3557// else
3558// {
3559// m_log.WarnFormat(
3560// "[CLIENT]: Preventing full update for {0} after kill to {1}", block.ID, Name);
3561// }
3527 } 3562 }
3528 }
3529 3563
3530 OutPacket(outPacket, ThrottleOutPacketType.State); 3564 outPacket.ObjectData = m_fullUpdateDataBlocksBuilder.ToArray();
3565
3566 OutPacket(outPacket, ThrottleOutPacketType.State);
3567 }
3531 } 3568 }
3532 3569
3533 public void SendPrimTerseUpdate(SendPrimitiveTerseData data) 3570 public void SendPrimTerseUpdate(SendPrimitiveTerseData data)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 3c4fa72..5ed4cd7 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -513,6 +513,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
513 byte flags = buffer.Data[0]; 513 byte flags = buffer.Data[0];
514 bool isResend = (flags & Helpers.MSG_RESENT) != 0; 514 bool isResend = (flags & Helpers.MSG_RESENT) != 0;
515 bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0; 515 bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0;
516 bool isZerocoded = (flags & Helpers.MSG_ZEROCODED) != 0;
516 LLUDPClient udpClient = outgoingPacket.Client; 517 LLUDPClient udpClient = outgoingPacket.Client;
517 518
518 if (!udpClient.IsConnected) 519 if (!udpClient.IsConnected)
@@ -522,23 +523,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
522 523
523 int dataLength = buffer.DataLength; 524 int dataLength = buffer.DataLength;
524 525
525 // Keep appending ACKs until there is no room left in the buffer or there are 526 // NOTE: I'm seeing problems with some viewers when ACKs are appended to zerocoded packets so I've disabled that here
526 // no more ACKs to append 527 if (!isZerocoded)
527 uint ackCount = 0;
528 uint ack;
529 while (dataLength + 5 < buffer.Data.Length && udpClient.PendingAcks.Dequeue(out ack))
530 { 528 {
531 Utils.UIntToBytesBig(ack, buffer.Data, dataLength); 529 // Keep appending ACKs until there is no room left in the buffer or there are
532 dataLength += 4; 530 // no more ACKs to append
533 ++ackCount; 531 uint ackCount = 0;
534 } 532 uint ack;
533 while (dataLength + 5 < buffer.Data.Length && udpClient.PendingAcks.Dequeue(out ack))
534 {
535 Utils.UIntToBytesBig(ack, buffer.Data, dataLength);
536 dataLength += 4;
537 ++ackCount;
538 }
535 539
536 if (ackCount > 0) 540 if (ackCount > 0)
537 { 541 {
538 // Set the last byte of the packet equal to the number of appended ACKs 542 // Set the last byte of the packet equal to the number of appended ACKs
539 buffer.Data[dataLength++] = (byte)ackCount; 543 buffer.Data[dataLength++] = (byte)ackCount;
540 // Set the appended ACKs flag on this packet 544 // Set the appended ACKs flag on this packet
541 buffer.Data[0] = (byte)(buffer.Data[0] | Helpers.MSG_APPENDED_ACKS); 545 buffer.Data[0] = (byte)(buffer.Data[0] | Helpers.MSG_APPENDED_ACKS);
546 }
542 } 547 }
543 548
544 buffer.DataLength = dataLength; 549 buffer.DataLength = dataLength;