aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorOren Hurvitz2014-04-23 08:44:00 +0300
committerOren Hurvitz2014-04-23 16:42:23 +0300
commit7eb12f96ec91b5c2dec5468af5088dbaed12d4e8 (patch)
tree431fb4521f09fa520b975f8fe017802121c12a35 /OpenSim
parentRemoved references to Community.CsharpSqlite*.dll. This eliminates some warni... (diff)
downloadopensim-SC-7eb12f96ec91b5c2dec5468af5088dbaed12d4e8.zip
opensim-SC-7eb12f96ec91b5c2dec5468af5088dbaed12d4e8.tar.gz
opensim-SC-7eb12f96ec91b5c2dec5468af5088dbaed12d4e8.tar.bz2
opensim-SC-7eb12f96ec91b5c2dec5468af5088dbaed12d4e8.tar.xz
Hypergrid: don't send Local assets to other grids
This commit also contains other changes, but they're all just for clarity. The only actual behavior change is to avoid Posting local assets.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs69
1 files changed, 34 insertions, 35 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index cbf32ad..04615a9 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -118,45 +118,44 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
118 if (string.IsNullOrEmpty(url)) 118 if (string.IsNullOrEmpty(url))
119 return false; 119 return false;
120 120
121 if (asset != null) 121 if (!url.EndsWith("/") && !url.EndsWith("="))
122 { 122 url = url + "/";
123 if (!url.EndsWith("/") && !url.EndsWith("="))
124 url = url + "/";
125
126 bool success = true;
127 // See long comment in AssetCache.AddAsset
128 if (!asset.Temporary || asset.Local)
129 {
130 // We need to copy the asset into a new asset, because
131 // we need to set its ID to be URL+UUID, so that the
132 // HGAssetService dispatches it to the remote grid.
133 // It's not pretty, but the best that can be done while
134 // not having a global naming infrastructure
135 AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID);
136 Copy(asset, asset1);
137 asset1.ID = url + asset.ID;
138
139 AdjustIdentifiers(asset1.Metadata);
140 if (asset1.Metadata.Type == (sbyte)AssetType.Object)
141 asset1.Data = AdjustIdentifiers(asset.Data);
142 else
143 asset1.Data = asset.Data;
144 123
145 string id = m_scene.AssetService.Store(asset1); 124 if (asset == null)
146 if (String.IsNullOrEmpty(id)) 125 {
147 { 126 m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache.");
148 m_log.DebugFormat("[HG ASSET MAPPER]: Failed to post asset {0} to asset server {1}: the server did not accept the asset", asset.ID, url); 127 return false;
149 success = false;
150 }
151 else
152 m_log.DebugFormat("[HG ASSET MAPPER]: Posted asset {0} to asset server {1}", asset1.ID, url);
153 }
154 return success;
155 } 128 }
129
130 // See long comment in AssetCache.AddAsset
131 if (asset.Temporary || asset.Local)
132 return true;
133
134 // We need to copy the asset into a new asset, because
135 // we need to set its ID to be URL+UUID, so that the
136 // HGAssetService dispatches it to the remote grid.
137 // It's not pretty, but the best that can be done while
138 // not having a global naming infrastructure
139 AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID);
140 Copy(asset, asset1);
141 asset1.ID = url + asset.ID;
142
143 AdjustIdentifiers(asset1.Metadata);
144 if (asset1.Metadata.Type == (sbyte)AssetType.Object)
145 asset1.Data = AdjustIdentifiers(asset.Data);
156 else 146 else
157 m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache."); 147 asset1.Data = asset.Data;
158 148
159 return false; 149 string id = m_scene.AssetService.Store(asset1);
150 if (String.IsNullOrEmpty(id))
151 {
152 m_log.DebugFormat("[HG ASSET MAPPER]: Asset server {0} did not accept {1}", url, asset.ID);
153 return false;
154 }
155 else {
156 m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url);
157 return true;
158 }
160 } 159 }
161 160
162 private void Copy(AssetBase from, AssetBase to) 161 private void Copy(AssetBase from, AssetBase to)