diff options
Merge branch 'master' into vehicles
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 190 |
1 files changed, 98 insertions, 92 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 0ba76ec..f6a7a0c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -346,15 +346,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
346 | protected int m_terrainCheckerCount; | 346 | protected int m_terrainCheckerCount; |
347 | protected uint m_agentFOVCounter; | 347 | protected uint m_agentFOVCounter; |
348 | 348 | ||
349 | // These numbers are guesses at a decent tradeoff between responsiveness | ||
350 | // of the interest list and throughput. Lower is more responsive, higher | ||
351 | // is better throughput | ||
352 | protected int m_primTerseUpdatesPerPacket = 25; | ||
353 | protected int m_primFullUpdatesPerPacket = 100; | ||
354 | protected int m_avatarTerseUpdatesPerPacket = 10; | ||
355 | /// <summary>Number of texture packets to put on the queue each time the | ||
356 | /// OnQueueEmpty event is triggered for the texture category</summary> | ||
357 | protected int m_textureSendLimit = 20; | ||
358 | protected IAssetService m_assetService; | 349 | protected IAssetService m_assetService; |
359 | private IHyperAssetService m_hyperAssets; | 350 | private IHyperAssetService m_hyperAssets; |
360 | 351 | ||
@@ -827,7 +818,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
827 | for (int i = x1; i <= x2; i++) | 818 | for (int i = x1; i <= x2; i++) |
828 | SendLayerData(i, y1, map); | 819 | SendLayerData(i, y1, map); |
829 | 820 | ||
830 | // Column | 821 | // Column |
831 | for (int j = y1 + 1; j <= y2; j++) | 822 | for (int j = y1 + 1; j <= y2; j++) |
832 | SendLayerData(x2, j, map); | 823 | SendLayerData(x2, j, map); |
833 | 824 | ||
@@ -2114,12 +2105,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2114 | public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks) | 2105 | public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks) |
2115 | { | 2106 | { |
2116 | ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect); | 2107 | ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect); |
2117 | packet.Effect = effectBlocks; | 2108 | packet.Header.Reliable = false; |
2109 | packet.Header.Zerocoded = true; | ||
2118 | 2110 | ||
2119 | packet.AgentData.AgentID = AgentId; | 2111 | packet.AgentData.AgentID = AgentId; |
2120 | packet.AgentData.SessionID = SessionId; | 2112 | packet.AgentData.SessionID = SessionId; |
2121 | packet.Header.Reliable = false; | 2113 | |
2122 | packet.Header.Zerocoded = true; | 2114 | packet.Effect = effectBlocks; |
2115 | |||
2123 | OutPacket(packet, ThrottleOutPacketType.State); | 2116 | OutPacket(packet, ThrottleOutPacketType.State); |
2124 | } | 2117 | } |
2125 | 2118 | ||
@@ -3333,7 +3326,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3333 | 3326 | ||
3334 | lock (m_avatarTerseUpdates.SyncRoot) | 3327 | lock (m_avatarTerseUpdates.SyncRoot) |
3335 | { | 3328 | { |
3336 | int count = Math.Min(m_avatarTerseUpdates.Count, m_avatarTerseUpdatesPerPacket); | 3329 | int count = Math.Min(m_avatarTerseUpdates.Count, m_udpServer.AvatarTerseUpdatesPerPacket); |
3337 | if (count == 0) | 3330 | if (count == 0) |
3338 | return; | 3331 | return; |
3339 | 3332 | ||
@@ -3418,7 +3411,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3418 | 3411 | ||
3419 | lock (m_primFullUpdates.SyncRoot) | 3412 | lock (m_primFullUpdates.SyncRoot) |
3420 | { | 3413 | { |
3421 | int count = Math.Min(m_primFullUpdates.Count, m_primFullUpdatesPerPacket); | 3414 | int count = Math.Min(m_primFullUpdates.Count, m_udpServer.PrimFullUpdatesPerPacket); |
3422 | if (count == 0) | 3415 | if (count == 0) |
3423 | return; | 3416 | return; |
3424 | 3417 | ||
@@ -3462,7 +3455,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3462 | 3455 | ||
3463 | lock (m_primTerseUpdates.SyncRoot) | 3456 | lock (m_primTerseUpdates.SyncRoot) |
3464 | { | 3457 | { |
3465 | int count = Math.Min(m_primTerseUpdates.Count, m_primTerseUpdatesPerPacket); | 3458 | int count = Math.Min(m_primTerseUpdates.Count, m_udpServer.PrimTerseUpdatesPerPacket); |
3466 | if (count == 0) | 3459 | if (count == 0) |
3467 | return; | 3460 | return; |
3468 | 3461 | ||
@@ -3585,7 +3578,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3585 | void ProcessTextureRequests() | 3578 | void ProcessTextureRequests() |
3586 | { | 3579 | { |
3587 | if (m_imageManager != null) | 3580 | if (m_imageManager != null) |
3588 | m_imageManager.ProcessImageQueue(m_textureSendLimit); | 3581 | m_imageManager.ProcessImageQueue(m_udpServer.TextureSendLimit); |
3589 | } | 3582 | } |
3590 | 3583 | ||
3591 | public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) | 3584 | public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) |
@@ -4167,6 +4160,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4167 | 4160 | ||
4168 | pack.Data = dataBlock; | 4161 | pack.Data = dataBlock; |
4169 | } | 4162 | } |
4163 | else | ||
4164 | { | ||
4165 | pack.Data = new ParcelObjectOwnersReplyPacket.DataBlock[0]; | ||
4166 | } | ||
4170 | pack.Header.Zerocoded = true; | 4167 | pack.Header.Zerocoded = true; |
4171 | this.OutPacket(pack, ThrottleOutPacketType.Task); | 4168 | this.OutPacket(pack, ThrottleOutPacketType.Task); |
4172 | } | 4169 | } |
@@ -4434,6 +4431,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4434 | protected virtual void RegisterLocalPacketHandlers() | 4431 | protected virtual void RegisterLocalPacketHandlers() |
4435 | { | 4432 | { |
4436 | AddLocalPacketHandler(PacketType.LogoutRequest, Logout); | 4433 | AddLocalPacketHandler(PacketType.LogoutRequest, Logout); |
4434 | AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate); | ||
4437 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect); | 4435 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect); |
4438 | AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached); | 4436 | AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached); |
4439 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); | 4437 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); |
@@ -4446,6 +4444,75 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4446 | 4444 | ||
4447 | #region Packet Handlers | 4445 | #region Packet Handlers |
4448 | 4446 | ||
4447 | private bool HandleAgentUpdate(IClientAPI sener, Packet Pack) | ||
4448 | { | ||
4449 | if (OnAgentUpdate != null) | ||
4450 | { | ||
4451 | bool update = false; | ||
4452 | AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; | ||
4453 | |||
4454 | #region Packet Session and User Check | ||
4455 | if (agenUpdate.AgentData.SessionID != SessionId || agenUpdate.AgentData.AgentID != AgentId) | ||
4456 | return false; | ||
4457 | #endregion | ||
4458 | |||
4459 | AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData; | ||
4460 | |||
4461 | // We can only check when we have something to check | ||
4462 | // against. | ||
4463 | |||
4464 | if (lastarg != null) | ||
4465 | { | ||
4466 | update = | ||
4467 | ( | ||
4468 | (x.BodyRotation != lastarg.BodyRotation) || | ||
4469 | (x.CameraAtAxis != lastarg.CameraAtAxis) || | ||
4470 | (x.CameraCenter != lastarg.CameraCenter) || | ||
4471 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || | ||
4472 | (x.CameraUpAxis != lastarg.CameraUpAxis) || | ||
4473 | (x.ControlFlags != lastarg.ControlFlags) || | ||
4474 | (x.Far != lastarg.Far) || | ||
4475 | (x.Flags != lastarg.Flags) || | ||
4476 | (x.State != lastarg.State) || | ||
4477 | (x.HeadRotation != lastarg.HeadRotation) || | ||
4478 | (x.SessionID != lastarg.SessionID) || | ||
4479 | (x.AgentID != lastarg.AgentID) | ||
4480 | ); | ||
4481 | } | ||
4482 | else | ||
4483 | update = true; | ||
4484 | |||
4485 | // These should be ordered from most-likely to | ||
4486 | // least likely to change. I've made an initial | ||
4487 | // guess at that. | ||
4488 | |||
4489 | if (update) | ||
4490 | { | ||
4491 | AgentUpdateArgs arg = new AgentUpdateArgs(); | ||
4492 | arg.AgentID = x.AgentID; | ||
4493 | arg.BodyRotation = x.BodyRotation; | ||
4494 | arg.CameraAtAxis = x.CameraAtAxis; | ||
4495 | arg.CameraCenter = x.CameraCenter; | ||
4496 | arg.CameraLeftAxis = x.CameraLeftAxis; | ||
4497 | arg.CameraUpAxis = x.CameraUpAxis; | ||
4498 | arg.ControlFlags = x.ControlFlags; | ||
4499 | arg.Far = x.Far; | ||
4500 | arg.Flags = x.Flags; | ||
4501 | arg.HeadRotation = x.HeadRotation; | ||
4502 | arg.SessionID = x.SessionID; | ||
4503 | arg.State = x.State; | ||
4504 | UpdateAgent handlerAgentUpdate = OnAgentUpdate; | ||
4505 | lastarg = arg; // save this set of arguments for nexttime | ||
4506 | if (handlerAgentUpdate != null) | ||
4507 | OnAgentUpdate(this, arg); | ||
4508 | |||
4509 | handlerAgentUpdate = null; | ||
4510 | } | ||
4511 | } | ||
4512 | |||
4513 | return true; | ||
4514 | } | ||
4515 | |||
4449 | private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack) | 4516 | private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack) |
4450 | { | 4517 | { |
4451 | MoneyTransferRequestPacket money = (MoneyTransferRequestPacket)Pack; | 4518 | MoneyTransferRequestPacket money = (MoneyTransferRequestPacket)Pack; |
@@ -5631,77 +5698,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5631 | 5698 | ||
5632 | break; | 5699 | break; |
5633 | 5700 | ||
5634 | case PacketType.AgentUpdate: | ||
5635 | if (OnAgentUpdate != null) | ||
5636 | { | ||
5637 | bool update = false; | ||
5638 | AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; | ||
5639 | |||
5640 | #region Packet Session and User Check | ||
5641 | if (m_checkPackets) | ||
5642 | { | ||
5643 | if (agenUpdate.AgentData.SessionID != SessionId || | ||
5644 | agenUpdate.AgentData.AgentID != AgentId) | ||
5645 | break; | ||
5646 | } | ||
5647 | #endregion | ||
5648 | |||
5649 | AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData; | ||
5650 | |||
5651 | // We can only check when we have something to check | ||
5652 | // against. | ||
5653 | |||
5654 | if (lastarg != null) | ||
5655 | { | ||
5656 | update = | ||
5657 | ( | ||
5658 | (x.BodyRotation != lastarg.BodyRotation) || | ||
5659 | (x.CameraAtAxis != lastarg.CameraAtAxis) || | ||
5660 | (x.CameraCenter != lastarg.CameraCenter) || | ||
5661 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || | ||
5662 | (x.CameraUpAxis != lastarg.CameraUpAxis) || | ||
5663 | (x.ControlFlags != lastarg.ControlFlags) || | ||
5664 | (x.Far != lastarg.Far) || | ||
5665 | (x.Flags != lastarg.Flags) || | ||
5666 | (x.State != lastarg.State) || | ||
5667 | (x.HeadRotation != lastarg.HeadRotation) || | ||
5668 | (x.SessionID != lastarg.SessionID) || | ||
5669 | (x.AgentID != lastarg.AgentID) | ||
5670 | ); | ||
5671 | } | ||
5672 | else | ||
5673 | update = true; | ||
5674 | |||
5675 | // These should be ordered from most-likely to | ||
5676 | // least likely to change. I've made an initial | ||
5677 | // guess at that. | ||
5678 | |||
5679 | if (update) | ||
5680 | { | ||
5681 | AgentUpdateArgs arg = new AgentUpdateArgs(); | ||
5682 | arg.AgentID = x.AgentID; | ||
5683 | arg.BodyRotation = x.BodyRotation; | ||
5684 | arg.CameraAtAxis = x.CameraAtAxis; | ||
5685 | arg.CameraCenter = x.CameraCenter; | ||
5686 | arg.CameraLeftAxis = x.CameraLeftAxis; | ||
5687 | arg.CameraUpAxis = x.CameraUpAxis; | ||
5688 | arg.ControlFlags = x.ControlFlags; | ||
5689 | arg.Far = x.Far; | ||
5690 | arg.Flags = x.Flags; | ||
5691 | arg.HeadRotation = x.HeadRotation; | ||
5692 | arg.SessionID = x.SessionID; | ||
5693 | arg.State = x.State; | ||
5694 | UpdateAgent handlerAgentUpdate = OnAgentUpdate; | ||
5695 | lastarg = arg; // save this set of arguments for nexttime | ||
5696 | if (handlerAgentUpdate != null) | ||
5697 | OnAgentUpdate(this, arg); | ||
5698 | |||
5699 | handlerAgentUpdate = null; | ||
5700 | } | ||
5701 | |||
5702 | } | ||
5703 | break; | ||
5704 | |||
5705 | case PacketType.AgentAnimation: | 5701 | case PacketType.AgentAnimation: |
5706 | AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; | 5702 | AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; |
5707 | 5703 | ||
@@ -6762,11 +6758,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6762 | if (OnRequestTexture != null) | 6758 | if (OnRequestTexture != null) |
6763 | { | 6759 | { |
6764 | TextureRequestArgs args = new TextureRequestArgs(); | 6760 | TextureRequestArgs args = new TextureRequestArgs(); |
6765 | args.RequestedAssetID = imageRequest.RequestImage[i].Image; | 6761 | |
6766 | args.DiscardLevel = imageRequest.RequestImage[i].DiscardLevel; | 6762 | RequestImagePacket.RequestImageBlock block = imageRequest.RequestImage[i]; |
6767 | args.PacketNumber = imageRequest.RequestImage[i].Packet; | 6763 | |
6768 | args.Priority = imageRequest.RequestImage[i].DownloadPriority; | 6764 | args.RequestedAssetID = block.Image; |
6765 | args.DiscardLevel = block.DiscardLevel; | ||
6766 | args.PacketNumber = block.Packet; | ||
6767 | args.Priority = block.DownloadPriority; | ||
6769 | args.requestSequence = imageRequest.Header.Sequence; | 6768 | args.requestSequence = imageRequest.Header.Sequence; |
6769 | |||
6770 | // NOTE: This is not a built in part of the LLUDP protocol, but we double the | ||
6771 | // priority of avatar textures to get avatars rezzing in faster than the | ||
6772 | // surrounding scene | ||
6773 | if ((ImageType)block.Type == ImageType.Baked) | ||
6774 | args.Priority *= 2.0f; | ||
6775 | |||
6770 | //handlerTextureRequest = OnRequestTexture; | 6776 | //handlerTextureRequest = OnRequestTexture; |
6771 | 6777 | ||
6772 | //if (handlerTextureRequest != null) | 6778 | //if (handlerTextureRequest != null) |