aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs111
1 files changed, 88 insertions, 23 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 691b7bb..171f8c6 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4102,7 +4102,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4102 if (mysp == null) 4102 if (mysp == null)
4103 return; 4103 return;
4104 4104
4105 List<ObjectUpdatePacket.ObjectDataBlock> objectUpdateBlocks = null;
4106 // List<ObjectUpdateCompressedPacket.ObjectDataBlock> compressedUpdateBlocks = null; 4105 // List<ObjectUpdateCompressedPacket.ObjectDataBlock> compressedUpdateBlocks = null;
4107 List<EntityUpdate> objectUpdates = null; 4106 List<EntityUpdate> objectUpdates = null;
4108 // List<EntityUpdate> compressedUpdates = null; 4107 // List<EntityUpdate> compressedUpdates = null;
@@ -4349,22 +4348,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4349 } 4348 }
4350 else 4349 else
4351 { 4350 {
4352 ObjectUpdatePacket.ObjectDataBlock ablock;
4353 if (update.Entity is ScenePresence) 4351 if (update.Entity is ScenePresence)
4354 { 4352 maxUpdatesBytes -= 150; // crude estimation
4355 ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
4356 }
4357 else 4353 else
4358 ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, mysp); 4354 maxUpdatesBytes -= 300;
4359 if(objectUpdateBlocks == null) 4355
4356 if(objectUpdates == null)
4360 { 4357 {
4361 objectUpdateBlocks = new List<ObjectUpdatePacket.ObjectDataBlock>();
4362 objectUpdates = new List<EntityUpdate>(); 4358 objectUpdates = new List<EntityUpdate>();
4363 maxUpdatesBytes -= 18; 4359 maxUpdatesBytes -= 18;
4364 } 4360 }
4365 objectUpdateBlocks.Add(ablock);
4366 objectUpdates.Add(update); 4361 objectUpdates.Add(update);
4367 maxUpdatesBytes -= ablock.Length;
4368 } 4362 }
4369 4363
4370 #endregion Block Construction 4364 #endregion Block Construction
@@ -4379,16 +4373,86 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4379 4373
4380 timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); 4374 timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
4381 4375
4382 if (objectUpdateBlocks != null) 4376 if(objectUpdates != null)
4383 { 4377 {
4384 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); 4378 int blocks = objectUpdates.Count;
4385 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4379 List<EntityUpdate> tau = new List<EntityUpdate>(30);
4386 packet.RegionData.TimeDilation = timeDilation; 4380
4387 packet.ObjectData = objectUpdateBlocks.ToArray(); 4381 UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint);
4388 objectUpdateBlocks.Clear(); 4382 Buffer.BlockCopy(objectUpdateHeader, 0, buf.Data, 0, 7);
4383
4384 LLUDPZeroEncoder zc = new LLUDPZeroEncoder(buf.Data);
4385 zc.Position = 7;
4386
4387 zc.AddUInt64(m_scene.RegionInfo.RegionHandle);
4388 zc.AddUInt16(Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f));
4389
4390 zc.AddByte(1); // tmp block count
4391
4392 int countposition = zc.Position - 1;
4393
4394 int lastpos = 0;
4395 int lastzc = 0;
4396
4397 int count = 0;
4398 foreach (EntityUpdate eu in objectUpdates)
4399 {
4400 lastpos = zc.Position;
4401 lastzc = zc.ZeroCount;
4402 if (eu.Entity is ScenePresence)
4403 CreateAvatarUpdateBlock((ScenePresence)eu.Entity, zc);
4404 else
4405 CreatePrimUpdateBlock((SceneObjectPart)eu.Entity, mysp, zc);
4406 if (zc.Position < LLUDPServer.MTU - 5)
4407 {
4408 tau.Add(eu);
4409 ++count;
4410 --blocks;
4411 }
4412 else if (blocks > 0)
4413 {
4414 // we need more packets
4415 UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint);
4416 Buffer.BlockCopy(buf.Data, 0, newbuf.Data, 0, countposition); // start is the same
4417
4418 buf.Data[countposition] = (byte)count;
4419 // get pending zeros at cut point
4420 if(lastzc > 0)
4421 {
4422 buf.Data[lastpos++] = 0;
4423 buf.Data[lastpos++] = (byte)lastzc;
4424 }
4425 buf.DataLength = lastpos;
4426
4427 m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task,
4428 delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false);
4429
4430 buf = newbuf;
4431 zc.Data = buf.Data;
4432 zc.ZeroCount = 0;
4433 zc.Position = countposition + 1;
4434 // im lazy now, just do last again
4435 if (eu.Entity is ScenePresence)
4436 CreateAvatarUpdateBlock((ScenePresence)eu.Entity, zc);
4437 else
4438 CreatePrimUpdateBlock((SceneObjectPart)eu.Entity, mysp, zc);
4439
4440 tau = new List<EntityUpdate>(30);
4441 tau.Add(eu);
4442 count = 1;
4443 --blocks;
4444 }
4445 }
4389 4446
4390 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates, oPacket); }); 4447 if (count > 0)
4448 {
4449 buf.Data[countposition] = (byte)count;
4450 buf.DataLength = zc.Finish();
4451 m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task,
4452 delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false);
4453 }
4391 } 4454 }
4455
4392/* 4456/*
4393 if (compressedUpdateBlocks != null) 4457 if (compressedUpdateBlocks != null)
4394 { 4458 {
@@ -6289,7 +6353,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6289 else 6353 else
6290 { 6354 {
6291 int len = tentry.Length; 6355 int len = tentry.Length;
6292 zc.AddUInt((ushort)len); 6356 zc.AddByte((byte)len);
6357 zc.AddByte((byte)(len >> 8));
6293 zc.AddBytes(tentry, len); 6358 zc.AddBytes(tentry, len);
6294 } 6359 }
6295 6360
@@ -6327,7 +6392,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6327 } 6392 }
6328 6393
6329 //text 6394 //text
6330 if (part.Text.Length == 0) 6395 if (part.Text == null || part.Text.Length == 0)
6331 zc.AddZeros(5); 6396 zc.AddZeros(5);
6332 else 6397 else
6333 { 6398 {
@@ -6342,7 +6407,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6342 } 6407 }
6343 6408
6344 //media url 6409 //media url
6345 if (part.MediaUrl.Length == 0) 6410 if (part.MediaUrl == null || part.MediaUrl.Length == 0)
6346 zc.AddZeros(1); 6411 zc.AddZeros(1);
6347 else 6412 else
6348 { 6413 {
@@ -6355,19 +6420,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6355 bool hasps = false; 6420 bool hasps = false;
6356 //particle system 6421 //particle system
6357 byte[] ps = part.ParticleSystem; 6422 byte[] ps = part.ParticleSystem;
6358 if (ps == null) 6423 if (ps == null || ps.Length < 1)
6359 zc.AddZeros(1); 6424 zc.AddZeros(1);
6360 else 6425 else
6361 { 6426 {
6362 int len = ps.Length; 6427 int len = ps.Length;
6363 zc.AddByte((byte)len); 6428 zc.AddByte((byte)len);
6364 zc.AddBytes(ps, len); 6429 zc.AddBytes(ps, len);
6365 hasps = len > 1; 6430 hasps = true;
6366 } 6431 }
6367 6432
6368 //Extraparams 6433 //Extraparams
6369 byte[] ep = part.Shape.ExtraParams; 6434 byte[] ep = part.Shape.ExtraParams;
6370 if (ep == null) 6435 if (ep == null || ep.Length < 2)
6371 zc.AddZeros(1); 6436 zc.AddZeros(1);
6372 else 6437 else
6373 { 6438 {