aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2012-09-21 17:58:44 -0700
committerDiva Canto2012-09-21 17:58:44 -0700
commit21a6ef5bb63e56612b8e03002dbee9ff1fcdc4c0 (patch)
treed2d6c2e55e7894e5d129621d7f0145768bd8dadb /OpenSim/Region
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-21a6ef5bb63e56612b8e03002dbee9ff1fcdc4c0.zip
opensim-SC-21a6ef5bb63e56612b8e03002dbee9ff1fcdc4c0.tar.gz
opensim-SC-21a6ef5bb63e56612b8e03002dbee9ff1fcdc4c0.tar.bz2
opensim-SC-21a6ef5bb63e56612b8e03002dbee9ff1fcdc4c0.tar.xz
This fixes HG attachments' missing assets (textures, etc).
Also, further improvements on HGUuidGatherer: if the assets are already in this grid don't fetch them again.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs28
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs27
2 files changed, 45 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 0b386d3..a6698e6 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -150,6 +150,34 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
150 150
151 if (m_Enabled) 151 if (m_Enabled)
152 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); 152 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
153
154 scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject;
155 }
156
157 void OnIncomingSceneObject(SceneObjectGroup so)
158 {
159 if (!so.IsAttachment)
160 return;
161
162 if (so.Scene.UserManagementModule.IsLocalGridUser(so.AttachedAvatar))
163 return;
164
165 // foreign user
166 AgentCircuitData aCircuit = so.Scene.AuthenticateHandler.GetAgentCircuitData(so.AttachedAvatar);
167 if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
168 {
169 if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
170 {
171 string url = aCircuit.ServiceURLs["AssetServerURI"].ToString();
172 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Incoming attachement {0} for HG user {1} with asset server {2}", so.Name, so.AttachedAvatar, url);
173 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
174 HGUuidGatherer uuidGatherer = new HGUuidGatherer(so.Scene.AssetService, url);
175 uuidGatherer.GatherAssetUuids(so, ids);
176
177 foreach (KeyValuePair<UUID, AssetType> kvp in ids)
178 uuidGatherer.FetchAsset(kvp.Key);
179 }
180 }
153 } 181 }
154 182
155 protected override void OnNewClient(IClientAPI client) 183 protected override void OnNewClient(IClientAPI client)
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 383604d..28cd09f 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -377,6 +377,8 @@ namespace OpenSim.Region.Framework.Scenes
377 : base(assetService) 377 : base(assetService)
378 { 378 {
379 m_assetServerURL = assetServerURL; 379 m_assetServerURL = assetServerURL;
380 if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("="))
381 m_assetServerURL = m_assetServerURL + "/";
380 } 382 }
381 383
382 protected override AssetBase GetAsset(UUID uuid) 384 protected override AssetBase GetAsset(UUID uuid)
@@ -384,22 +386,27 @@ namespace OpenSim.Region.Framework.Scenes
384 if (string.Empty == m_assetServerURL) 386 if (string.Empty == m_assetServerURL)
385 return base.GetAsset(uuid); 387 return base.GetAsset(uuid);
386 else 388 else
387 return FetchAsset(m_assetServerURL, uuid); 389 return FetchAsset(uuid);
388 } 390 }
389 391
390 public AssetBase FetchAsset(string url, UUID assetID) 392 public AssetBase FetchAsset(UUID assetID)
391 { 393 {
392 if (!url.EndsWith("/") && !url.EndsWith("="))
393 url = url + "/";
394 394
395 AssetBase asset = m_assetService.Get(url + assetID.ToString()); 395 // Test if it's already here
396 396 AssetBase asset = m_assetService.Get(assetID.ToString());
397 if (asset != null) 397 if (asset == null)
398 { 398 {
399 m_log.DebugFormat("[HGUUIDGatherer]: Copied asset {0} from {1} to local asset server. ", asset.ID, url); 399 // It's not, so fetch it from abroad
400 return asset; 400 asset = m_assetService.Get(m_assetServerURL + assetID.ToString());
401 if (asset != null)
402 m_log.DebugFormat("[HGUUIDGatherer]: Copied asset {0} from {1} to local asset server", assetID, m_assetServerURL);
403 else
404 m_log.DebugFormat("[HGUUIDGatherer]: Failed to fetch asset {0} from {1}", assetID, m_assetServerURL);
401 } 405 }
402 return null; 406 //else
407 // m_log.DebugFormat("[HGUUIDGatherer]: Asset {0} from {1} was already here", assetID, m_assetServerURL);
408
409 return asset;
403 } 410 }
404 } 411 }
405} 412}