aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorOren Hurvitz2014-07-14 10:55:57 +0300
committerJustin Clark-Casey2014-08-02 00:57:07 +0100
commit5f0456d91f9ace40959da8ee5e8e3590bddd8e09 (patch)
tree35e4f1d18502762aaab9ec31ecd50823b8f5095f
parentLog RestClient requests similarly to WebClient (e.g, "debug http all 6" logs ... (diff)
downloadopensim-SC-5f0456d91f9ace40959da8ee5e8e3590bddd8e09.zip
opensim-SC-5f0456d91f9ace40959da8ee5e8e3590bddd8e09.tar.gz
opensim-SC-5f0456d91f9ace40959da8ee5e8e3590bddd8e09.tar.bz2
opensim-SC-5f0456d91f9ace40959da8ee5e8e3590bddd8e09.tar.xz
XBakes: store the assets only in the sim's local assets cache; not in the main assets server. Also, some cleanup.
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs126
-rw-r--r--OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs3
2 files changed, 39 insertions, 90 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 196f19e..fde5657 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -11772,7 +11772,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11772 /// <returns></returns> 11772 /// <returns></returns>
11773 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) 11773 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
11774 { 11774 {
11775 //m_log.Debug("texture cached: " + packet.ToString());
11776 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; 11775 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
11777 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); 11776 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
11778 11777
@@ -11788,24 +11787,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11788 cachedresp.WearableData = 11787 cachedresp.WearableData =
11789 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; 11788 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
11790 11789
11791 //IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>();
11792 // var item = fac.GetBakedTextureFaces(AgentId);
11793 //WearableCacheItem[] items = fac.GetCachedItems(AgentId);
11794
11795 IAssetService cache = m_scene.AssetService;
11796 IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
11797 //bakedTextureModule = null;
11798 int maxWearablesLoop = cachedtex.WearableData.Length; 11790 int maxWearablesLoop = cachedtex.WearableData.Length;
11799 if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) 11791 if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
11800 maxWearablesLoop = AvatarWearable.MAX_WEARABLES; 11792 maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
11801 11793
11794 // Find the cached baked textures for this user, if they're available
11795
11796 IAssetService cache = m_scene.AssetService;
11797 IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
11798
11799 WearableCacheItem[] cacheItems = null;
11800
11802 if (bakedTextureModule != null && cache != null) 11801 if (bakedTextureModule != null && cache != null)
11803 { 11802 {
11804 // 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
11805
11806 WearableCacheItem[] cacheItems = null;
11807 ScenePresence p = m_scene.GetScenePresence(AgentId); 11803 ScenePresence p = m_scene.GetScenePresence(AgentId);
11808 if (p.Appearance != null) 11804 if (p.Appearance != null)
11805 {
11809 if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) 11806 if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty)
11810 { 11807 {
11811 try 11808 try
@@ -11814,22 +11811,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11814 p.Appearance.WearableCacheItems = cacheItems; 11811 p.Appearance.WearableCacheItems = cacheItems;
11815 p.Appearance.WearableCacheItemsDirty = false; 11812 p.Appearance.WearableCacheItemsDirty = false;
11816 } 11813 }
11817
11818 /*
11819 * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception!
11820 *
11821 catch (System.Net.Sockets.SocketException)
11822 {
11823 cacheItems = null;
11824 }
11825 catch (WebException)
11826 {
11827 cacheItems = null;
11828 }
11829 catch (InvalidOperationException)
11830 {
11831 cacheItems = null;
11832 } */
11833 catch (Exception) 11814 catch (Exception)
11834 { 11815 {
11835 cacheItems = null; 11816 cacheItems = null;
@@ -11840,87 +11821,54 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11840 { 11821 {
11841 cacheItems = p.Appearance.WearableCacheItems; 11822 cacheItems = p.Appearance.WearableCacheItems;
11842 } 11823 }
11824 }
11825 }
11843 11826
11844 if (cache != null && cacheItems != null) 11827 if (cacheItems != null)
11828 {
11829 // We need to make sure the asset stored in the bake is available on this server also by its assetid before we map it to a Cacheid.
11830 // Copy the baked textures to the sim's assets cache (local only).
11831 foreach (WearableCacheItem item in cacheItems)
11845 { 11832 {
11846 foreach (WearableCacheItem item in cacheItems) 11833 if (cache.GetCached(item.TextureID.ToString()) == null)
11847 { 11834 {
11848 11835 item.TextureAsset.Temporary = true;
11849 if (cache.GetCached(item.TextureID.ToString()) == null) 11836 item.TextureAsset.Local = true;
11850 { 11837 cache.Store(item.TextureAsset);
11851 item.TextureAsset.Temporary = true;
11852 cache.Store(item.TextureAsset);
11853 }
11854
11855
11856 } 11838 }
11857 } 11839 }
11858 if (cacheItems != null) 11840
11841 // Return the cached textures
11842 for (int i = 0; i < maxWearablesLoop; i++)
11859 { 11843 {
11844 WearableCacheItem item =
11845 WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex, cacheItems);
11860 11846
11861 for (int i = 0; i < maxWearablesLoop; i++) 11847 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11848 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11849 cachedresp.WearableData[i].HostName = new byte[0];
11850 if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
11862 { 11851 {
11863 WearableCacheItem item = 11852 cachedresp.WearableData[i].TextureID = item.TextureID;
11864 WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems);
11865
11866 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11867 cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex;
11868 cachedresp.WearableData[i].HostName = new byte[0];
11869 if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
11870 {
11871
11872 cachedresp.WearableData[i].TextureID = item.TextureID;
11873 }
11874 else
11875 {
11876 cachedresp.WearableData[i].TextureID = UUID.Zero;
11877 }
11878 } 11853 }
11879 } 11854 else
11880 else
11881 {
11882 for (int i = 0; i < maxWearablesLoop; i++)
11883 { 11855 {
11884 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11885 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11886 cachedresp.WearableData[i].TextureID = UUID.Zero; 11856 cachedresp.WearableData[i].TextureID = UUID.Zero;
11887 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11888 cachedresp.WearableData[i].HostName = new byte[0];
11889 } 11857 }
11890 } 11858 }
11891 } 11859 }
11892 else 11860 else
11893 { 11861 {
11894 if (cache == null) 11862 // Cached textures not available
11863 for (int i = 0; i < maxWearablesLoop; i++)
11895 { 11864 {
11896 for (int i = 0; i < maxWearablesLoop; i++) 11865 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11897 { 11866 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11898 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 11867 cachedresp.WearableData[i].TextureID = UUID.Zero;
11899 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; 11868 cachedresp.WearableData[i].HostName = new byte[0];
11900 cachedresp.WearableData[i].TextureID = UUID.Zero;
11901 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11902 cachedresp.WearableData[i].HostName = new byte[0];
11903 }
11904 }
11905 else
11906 {
11907 for (int i = 0; i < maxWearablesLoop; i++)
11908 {
11909 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11910 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11911
11912
11913
11914 if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null)
11915 cachedresp.WearableData[i].TextureID = UUID.Zero;
11916 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11917 else
11918 cachedresp.WearableData[i].TextureID = UUID.Zero;
11919 // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11920 cachedresp.WearableData[i].HostName = new byte[0];
11921 }
11922 } 11869 }
11923 } 11870 }
11871
11924 cachedresp.Header.Zerocoded = true; 11872 cachedresp.Header.Zerocoded = true;
11925 OutPacket(cachedresp, ThrottleOutPacketType.Task); 11873 OutPacket(cachedresp, ThrottleOutPacketType.Task);
11926 11874
diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
index 780d17b..5725d67 100644
--- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
@@ -135,7 +135,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
135 135
136 sr.ReadEndElement(); 136 sr.ReadEndElement();
137 } 137 }
138 m_log.DebugFormat("[XBakes]: Ended reading"); 138 m_log.DebugFormat("[XBakes]: read {0} textures for user {1}", ret.Count, id);
139 sr.Close(); 139 sr.Close();
140 s.Close(); 140 s.Close();
141 141
@@ -186,6 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
186 delegate 186 delegate
187 { 187 {
188 rc.Request(reqStream, m_Auth); 188 rc.Request(reqStream, m_Auth);
189 m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", data.Length, agentId);
189 } 190 }
190 ); 191 );
191 } 192 }