aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP
diff options
context:
space:
mode:
authorUbitUmarov2014-08-07 05:20:45 +0100
committerUbitUmarov2014-08-07 05:20:45 +0100
commitc3f9c99fb32d15e57b24502b71c79fe028ed3007 (patch)
tree0b7cef6c028edfff0e09ca6d5442141221bc85a2 /OpenSim/Region/ClientStack/Linden/UDP
parentbakemodule didnt like last changes (diff)
downloadopensim-SC-c3f9c99fb32d15e57b24502b71c79fe028ed3007.zip
opensim-SC-c3f9c99fb32d15e57b24502b71c79fe028ed3007.tar.gz
opensim-SC-c3f9c99fb32d15e57b24502b71c79fe028ed3007.tar.bz2
opensim-SC-c3f9c99fb32d15e57b24502b71c79fe028ed3007.tar.xz
DANGER... changed bakedtextures caching. Assuming grid baking is cache
only, reduced number of accesses to it. TESTING
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs110
1 files changed, 43 insertions, 67 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 08b6cb4..38a9af3 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -3684,6 +3684,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3684 avp.Sender.IsTrial = false; 3684 avp.Sender.IsTrial = false;
3685 avp.Sender.ID = agentID; 3685 avp.Sender.ID = agentID;
3686 avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; 3686 avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0];
3687
3688 // this need be use in future
3689 // avp.AppearanceData[0].AppearanceVersion = 0;
3690 // avp.AppearanceData[0].CofVersion = 0;
3691
3687 //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); 3692 //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
3688 OutPacket(avp, ThrottleOutPacketType.Task); 3693 OutPacket(avp, ThrottleOutPacketType.Task);
3689 } 3694 }
@@ -12006,8 +12011,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12006 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); 12011 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
12007 12012
12008 if (cachedtex.AgentData.SessionID != SessionId) 12013 if (cachedtex.AgentData.SessionID != SessionId)
12009 return false; 12014 return false;
12010
12011 12015
12012 // TODO: don't create new blocks if recycling an old packet 12016 // TODO: don't create new blocks if recycling an old packet
12013 cachedresp.AgentData.AgentID = AgentId; 12017 cachedresp.AgentData.AgentID = AgentId;
@@ -12022,23 +12026,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12022 //WearableCacheItem[] items = fac.GetCachedItems(AgentId); 12026 //WearableCacheItem[] items = fac.GetCachedItems(AgentId);
12023 12027
12024 IAssetService cache = m_scene.AssetService; 12028 IAssetService cache = m_scene.AssetService;
12025 IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
12026 //bakedTextureModule = null; 12029 //bakedTextureModule = null;
12027 int maxWearablesLoop = cachedtex.WearableData.Length; 12030 int maxWearablesLoop = cachedtex.WearableData.Length;
12028 if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) 12031 if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
12029 maxWearablesLoop = AvatarWearable.MAX_WEARABLES; 12032 maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
12030 12033
12031// if (bakedTextureModule != null && cache != null) 12034 int cacheHits = 0;
12035
12032 if (cache != null) 12036 if (cache != null)
12033 { 12037 {
12034 // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid 12038 // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid
12035 12039
12036 WearableCacheItem[] cacheItems = null; 12040 WearableCacheItem[] cacheItems = null;
12041
12037 ScenePresence p = m_scene.GetScenePresence(AgentId); 12042 ScenePresence p = m_scene.GetScenePresence(AgentId);
12038 if (p.Appearance != null) 12043
12044 if (p!= null && p.Appearance != null)
12039 { 12045 {
12040 if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) 12046 /* we should only check bakedTextureModule at login or when appearance changes
12047 if (p.Appearance.WearableCacheItems == null) // currently with a caching only bakemodule Appearance.Wearables.dirty as no use
12041 { 12048 {
12049 IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
12042 if (bakedTextureModule != null) 12050 if (bakedTextureModule != null)
12043 { 12051 {
12044 m_log.Debug("[ HandleAgentTextureCached] bakedTextureModule"); 12052 m_log.Debug("[ HandleAgentTextureCached] bakedTextureModule");
@@ -12047,23 +12055,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12047 cacheItems = bakedTextureModule.Get(AgentId); 12055 cacheItems = bakedTextureModule.Get(AgentId);
12048 p.Appearance.WearableCacheItems = cacheItems; 12056 p.Appearance.WearableCacheItems = cacheItems;
12049 p.Appearance.WearableCacheItemsDirty = false; 12057 p.Appearance.WearableCacheItemsDirty = false;
12050 }
12051 12058
12052 /* 12059 if (cacheItems != null)
12053 * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! 12060 {
12054 * 12061 foreach (WearableCacheItem item in cacheItems)
12055 catch (System.Net.Sockets.SocketException) 12062 {
12056 { 12063 if (item.TextureAsset != null)
12057 cacheItems = null; 12064 {
12058 } 12065 item.TextureAsset.Temporary = true;
12059 catch (WebException) 12066 item.TextureAsset.Local = true;
12060 { 12067 cache.Store(item.TextureAsset);
12061 cacheItems = null; 12068 }
12069 }
12070 }
12062 } 12071 }
12063 catch (InvalidOperationException) 12072
12064 {
12065 cacheItems = null;
12066 } */
12067 catch (Exception) 12073 catch (Exception)
12068 { 12074 {
12069 cacheItems = null; 12075 cacheItems = null;
@@ -12075,36 +12081,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12075 { 12081 {
12076 cacheItems = p.Appearance.WearableCacheItems; 12082 cacheItems = p.Appearance.WearableCacheItems;
12077 } 12083 }
12084*/
12085 cacheItems = p.Appearance.WearableCacheItems;
12078 } 12086 }
12079 12087
12080 if (cache != null && cacheItems != null)
12081 {
12082 foreach (WearableCacheItem item in cacheItems)
12083 {
12084
12085 if (cache.GetCached(item.TextureID.ToString()) == null)
12086 {
12087 item.TextureAsset.Temporary = true;
12088 cache.Store(item.TextureAsset);
12089 }
12090 }
12091 }
12092
12093 if (cacheItems != null) 12088 if (cacheItems != null)
12094 { 12089 {
12095
12096 for (int i = 0; i < maxWearablesLoop; i++) 12090 for (int i = 0; i < maxWearablesLoop; i++)
12097 { 12091 {
12098 WearableCacheItem item = 12092 int idx = cachedtex.WearableData[i].TextureIndex;
12099 WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems);
12100 12093
12101 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 12094 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
12102 cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; 12095 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
12103 cachedresp.WearableData[i].HostName = new byte[0]; 12096 cachedresp.WearableData[i].HostName = new byte[0];
12104 if (item != null && cachedtex.WearableData[i].ID == item.CacheId) 12097 if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId)
12105 { 12098 {
12106 12099 cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID;
12107 cachedresp.WearableData[i].TextureID = item.TextureID; 12100 cacheHits++;
12108 } 12101 }
12109 else 12102 else
12110 { 12103 {
@@ -12124,36 +12117,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12124 } 12117 }
12125 } 12118 }
12126 } 12119 }
12127 else 12120 else // no cache
12128 { 12121 {
12129 if (cache == null) 12122 for (int i = 0; i < maxWearablesLoop; i++)
12130 { 12123 {
12131 for (int i = 0; i < maxWearablesLoop; i++) 12124 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
12132 { 12125 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
12133 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 12126 cachedresp.WearableData[i].TextureID = UUID.Zero;
12134 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; 12127 cachedresp.WearableData[i].HostName = new byte[0];
12135 cachedresp.WearableData[i].TextureID = UUID.Zero;
12136 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
12137 cachedresp.WearableData[i].HostName = new byte[0];
12138 }
12139 }
12140 else
12141 {
12142 for (int i = 0; i < maxWearablesLoop; i++)
12143 {
12144 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
12145 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
12146
12147 if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null)
12148 cachedresp.WearableData[i].TextureID = UUID.Zero;
12149 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
12150// else
12151// cachedresp.WearableData[i].TextureID = UUID.Zero;
12152 // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
12153 cachedresp.WearableData[i].HostName = new byte[0];
12154 }
12155 } 12128 }
12156 } 12129 }
12130
12131 m_log.DebugFormat("texture cached: hits {0}", cacheHits);
12132
12157 cachedresp.Header.Zerocoded = true; 12133 cachedresp.Header.Zerocoded = true;
12158 OutPacket(cachedresp, ThrottleOutPacketType.Task); 12134 OutPacket(cachedresp, ThrottleOutPacketType.Task);
12159 12135