diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 117 |
1 files changed, 50 insertions, 67 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 88ace6a..3b43771 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -81,8 +81,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
81 | private List<ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates = | 81 | private List<ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates = |
82 | new List<ObjectUpdatePacket.ObjectDataBlock>(); | 82 | new List<ObjectUpdatePacket.ObjectDataBlock>(); |
83 | 83 | ||
84 | private Timer m_textureRequestTimer; | ||
85 | |||
86 | private bool m_clientBlocked; | 84 | private bool m_clientBlocked; |
87 | 85 | ||
88 | private int m_probesWithNoIngressPackets; | 86 | private int m_probesWithNoIngressPackets; |
@@ -143,9 +141,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
143 | protected int m_primTerseUpdateRate = 10; | 141 | protected int m_primTerseUpdateRate = 10; |
144 | protected int m_primFullUpdateRate = 14; | 142 | protected int m_primFullUpdateRate = 14; |
145 | 143 | ||
146 | protected int m_textureRequestRate = 100; | 144 | protected int m_textureSendLimit = 20; |
147 | protected int m_textureSendLimit = 10; | 145 | protected int m_textureDataLimit = 10; |
148 | protected int m_textureDataLimit = 5; | ||
149 | 146 | ||
150 | protected int m_packetMTU = 1400; | 147 | protected int m_packetMTU = 1400; |
151 | 148 | ||
@@ -534,6 +531,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
534 | m_PacketHandler = new LLPacketHandler(this, m_networkServer, userSettings); | 531 | m_PacketHandler = new LLPacketHandler(this, m_networkServer, userSettings); |
535 | m_PacketHandler.SynchronizeClient = SynchronizeClient; | 532 | m_PacketHandler.SynchronizeClient = SynchronizeClient; |
536 | m_PacketHandler.OnPacketStats += PopulateStats; | 533 | m_PacketHandler.OnPacketStats += PopulateStats; |
534 | m_PacketHandler.OnQueueEmpty += HandleQueueEmpty; | ||
537 | 535 | ||
538 | if (scene.Config != null) | 536 | if (scene.Config != null) |
539 | { | 537 | { |
@@ -555,9 +553,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
555 | m_primFullUpdateRate = clientConfig.GetInt("FullUpdateRate", | 553 | m_primFullUpdateRate = clientConfig.GetInt("FullUpdateRate", |
556 | m_primFullUpdateRate); | 554 | m_primFullUpdateRate); |
557 | 555 | ||
558 | m_textureRequestRate = clientConfig.GetInt("TextureRequestRate", | ||
559 | m_textureRequestRate); | ||
560 | |||
561 | m_textureSendLimit = clientConfig.GetInt("TextureSendLimit", | 556 | m_textureSendLimit = clientConfig.GetInt("TextureSendLimit", |
562 | m_textureSendLimit); | 557 | m_textureSendLimit); |
563 | 558 | ||
@@ -607,9 +602,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
607 | if (m_primFullUpdateTimer.Enabled) | 602 | if (m_primFullUpdateTimer.Enabled) |
608 | lock (m_primFullUpdateTimer) | 603 | lock (m_primFullUpdateTimer) |
609 | m_primFullUpdateTimer.Stop(); | 604 | m_primFullUpdateTimer.Stop(); |
610 | if (m_textureRequestTimer.Enabled) | ||
611 | lock (m_textureRequestTimer) | ||
612 | m_textureRequestTimer.Stop(); | ||
613 | 605 | ||
614 | // This is just to give the client a reasonable chance of | 606 | // This is just to give the client a reasonable chance of |
615 | // flushing out all it's packets. There should probably | 607 | // flushing out all it's packets. There should probably |
@@ -633,6 +625,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
633 | // of the client thread regardless of where Close() is called. | 625 | // of the client thread regardless of where Close() is called. |
634 | KillEndDone(); | 626 | KillEndDone(); |
635 | } | 627 | } |
628 | |||
629 | Terminate(); | ||
636 | } | 630 | } |
637 | 631 | ||
638 | /// <summary> | 632 | /// <summary> |
@@ -704,10 +698,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
704 | if (m_primFullUpdateTimer.Enabled) | 698 | if (m_primFullUpdateTimer.Enabled) |
705 | lock (m_primFullUpdateTimer) | 699 | lock (m_primFullUpdateTimer) |
706 | m_primFullUpdateTimer.Stop(); | 700 | m_primFullUpdateTimer.Stop(); |
707 | |||
708 | if (m_textureRequestTimer.Enabled) | ||
709 | lock (m_textureRequestTimer) | ||
710 | m_textureRequestTimer.Stop(); | ||
711 | } | 701 | } |
712 | 702 | ||
713 | public void Restart() | 703 | public void Restart() |
@@ -730,23 +720,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
730 | m_primFullUpdateTimer = new Timer(m_primFullUpdateRate); | 720 | m_primFullUpdateTimer = new Timer(m_primFullUpdateRate); |
731 | m_primFullUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessPrimFullUpdates); | 721 | m_primFullUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessPrimFullUpdates); |
732 | m_primFullUpdateTimer.AutoReset = false; | 722 | m_primFullUpdateTimer.AutoReset = false; |
733 | |||
734 | m_textureRequestTimer = new Timer(m_textureRequestRate); | ||
735 | m_textureRequestTimer.Elapsed += new ElapsedEventHandler(ProcessTextureRequests); | ||
736 | m_textureRequestTimer.AutoReset = false; | ||
737 | |||
738 | } | 723 | } |
739 | 724 | ||
740 | public void Terminate() | 725 | private void Terminate() |
741 | { | 726 | { |
727 | IsActive = false; | ||
728 | |||
729 | m_clientPingTimer.Close(); | ||
730 | m_avatarTerseUpdateTimer.Close(); | ||
731 | m_primTerseUpdateTimer.Close(); | ||
732 | m_primFullUpdateTimer.Close(); | ||
733 | |||
742 | m_PacketHandler.OnPacketStats -= PopulateStats; | 734 | m_PacketHandler.OnPacketStats -= PopulateStats; |
743 | m_PacketHandler.Stop(); | 735 | m_PacketHandler.Dispose(); |
744 | 736 | ||
745 | // wait for thread stoped | 737 | // wait for thread stoped |
746 | m_clientThread.Join(); | 738 | // m_clientThread.Join(); |
747 | 739 | ||
748 | // delete circuit code | 740 | // delete circuit code |
749 | m_networkServer.CloseClient(this); | 741 | //m_networkServer.CloseClient(this); |
750 | } | 742 | } |
751 | 743 | ||
752 | #endregion | 744 | #endregion |
@@ -876,6 +868,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
876 | while (IsActive) | 868 | while (IsActive) |
877 | { | 869 | { |
878 | LLQueItem nextPacket = m_PacketHandler.PacketQueue.Dequeue(); | 870 | LLQueItem nextPacket = m_PacketHandler.PacketQueue.Dequeue(); |
871 | |||
872 | if (nextPacket == null) { | ||
873 | m_log.DebugFormat("[CLIENT]: PacketQueue return null LLQueItem"); | ||
874 | continue; | ||
875 | } | ||
879 | 876 | ||
880 | if (nextPacket.Incoming) | 877 | if (nextPacket.Incoming) |
881 | { | 878 | { |
@@ -967,10 +964,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
967 | m_primFullUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessPrimFullUpdates); | 964 | m_primFullUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessPrimFullUpdates); |
968 | m_primFullUpdateTimer.AutoReset = false; | 965 | m_primFullUpdateTimer.AutoReset = false; |
969 | 966 | ||
970 | m_textureRequestTimer = new Timer(m_textureRequestRate); | ||
971 | m_textureRequestTimer.Elapsed += new ElapsedEventHandler(ProcessTextureRequests); | ||
972 | m_textureRequestTimer.AutoReset = false; | ||
973 | |||
974 | m_scene.AddNewClient(this); | 967 | m_scene.AddNewClient(this); |
975 | 968 | ||
976 | RefreshGroupMembership(); | 969 | RefreshGroupMembership(); |
@@ -1042,26 +1035,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1042 | } | 1035 | } |
1043 | } | 1036 | } |
1044 | 1037 | ||
1045 | protected virtual void TextureRequestHandler() | ||
1046 | { | ||
1047 | m_log.DebugFormat("[TRH] Thread started"); | ||
1048 | while (m_imageManager != null) | ||
1049 | { | ||
1050 | try | ||
1051 | { | ||
1052 | while (m_imageManager != null) | ||
1053 | { | ||
1054 | } | ||
1055 | } | ||
1056 | catch (Exception e) | ||
1057 | { | ||
1058 | m_log.WarnFormat("[TRH] Exception in handler loop: {0}", e.Message); | ||
1059 | m_log.Debug(e); | ||
1060 | } | ||
1061 | } | ||
1062 | m_log.DebugFormat("[TRH] Thread terminated"); | ||
1063 | } | ||
1064 | |||
1065 | # endregion | 1038 | # endregion |
1066 | 1039 | ||
1067 | // Previously ClientView.API partial class | 1040 | // Previously ClientView.API partial class |
@@ -3161,22 +3134,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3161 | } | 3134 | } |
3162 | } | 3135 | } |
3163 | 3136 | ||
3164 | // Unlike the other timers, this one is only started after | 3137 | void HandleQueueEmpty(ThrottleOutPacketType queue) |
3165 | // the first request is seen. | ||
3166 | |||
3167 | void ProcessTextureRequests(object sender, ElapsedEventArgs e) | ||
3168 | { | 3138 | { |
3169 | if (m_imageManager != null) | 3139 | switch (queue) |
3170 | { | 3140 | { |
3171 | if (m_imageManager.ProcessImageQueue(m_textureSendLimit, | 3141 | case ThrottleOutPacketType.Texture: |
3172 | m_textureDataLimit)) | 3142 | ProcessTextureRequests(); |
3173 | { | 3143 | break; |
3174 | lock (m_textureRequestTimer) | ||
3175 | m_textureRequestTimer.Start(); | ||
3176 | } | ||
3177 | } | 3144 | } |
3178 | } | 3145 | } |
3179 | 3146 | ||
3147 | void ProcessTextureRequests() | ||
3148 | { | ||
3149 | if (m_imageManager != null) | ||
3150 | m_imageManager.ProcessImageQueue(m_textureSendLimit, m_textureDataLimit); | ||
3151 | } | ||
3152 | |||
3180 | void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) | 3153 | void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) |
3181 | { | 3154 | { |
3182 | lock (m_primFullUpdates) | 3155 | lock (m_primFullUpdates) |
@@ -5275,13 +5248,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5275 | // for the client session anyway, in order to protect ourselves against bad code in plugins | 5248 | // for the client session anyway, in order to protect ourselves against bad code in plugins |
5276 | try | 5249 | try |
5277 | { | 5250 | { |
5278 | List<byte> visualparams = new List<byte>(); | 5251 | byte[] visualparams = new byte[appear.VisualParam.Length]; |
5279 | foreach (AgentSetAppearancePacket.VisualParamBlock x in appear.VisualParam) | 5252 | for (int i = 0; i < appear.VisualParam.Length; i++) |
5280 | { | 5253 | visualparams[i] = appear.VisualParam[i].ParamValue; |
5281 | visualparams.Add(x.ParamValue); | ||
5282 | } | ||
5283 | 5254 | ||
5284 | handlerSetAppearance(appear.ObjectData.TextureEntry, visualparams); | 5255 | Primitive.TextureEntry te = null; |
5256 | if (appear.ObjectData.TextureEntry.Length > 1) | ||
5257 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); | ||
5258 | |||
5259 | handlerSetAppearance(te, visualparams); | ||
5285 | } | 5260 | } |
5286 | catch (Exception e) | 5261 | catch (Exception e) |
5287 | { | 5262 | { |
@@ -6624,8 +6599,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6624 | if (m_imageManager != null) | 6599 | if (m_imageManager != null) |
6625 | { | 6600 | { |
6626 | m_imageManager.EnqueueReq(args); | 6601 | m_imageManager.EnqueueReq(args); |
6627 | lock (m_textureRequestTimer) | ||
6628 | m_textureRequestTimer.Start(); | ||
6629 | } | 6602 | } |
6630 | } | 6603 | } |
6631 | } | 6604 | } |
@@ -11026,5 +10999,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11026 | } | 10999 | } |
11027 | 11000 | ||
11028 | #endregion | 11001 | #endregion |
11002 | |||
11003 | public void SendRebakeAvatarTextures(UUID textureID) | ||
11004 | { | ||
11005 | RebakeAvatarTexturesPacket pack = | ||
11006 | (RebakeAvatarTexturesPacket)PacketPool.Instance.GetPacket(PacketType.RebakeAvatarTextures); | ||
11007 | |||
11008 | pack.TextureData = new RebakeAvatarTexturesPacket.TextureDataBlock(); | ||
11009 | pack.TextureData.TextureID = textureID; | ||
11010 | OutPacket(pack, ThrottleOutPacketType.Task); | ||
11011 | } | ||
11029 | } | 11012 | } |
11030 | } | 11013 | } |