Fix bug in HG attachment throttling code where attachments were never rezzed on any teleport within a foreign grid after the first.

Bug was introduced in ghosts branch commit 69abade
ghosts
Justin Clark-Casey (justincc) 2014-11-21 21:34:18 +00:00
parent c18cecbeb7
commit 8b267b5bb5
1 changed files with 64 additions and 56 deletions

View File

@ -576,81 +576,89 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// foreign user // foreign user
AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(so.OwnerID); AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(so.OwnerID);
if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) if (aCircuit != null)
{ {
if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) == 0)
{ {
m_incomingSceneObjectEngine.QueueRequest( // We have already pulled the necessary attachments from the source grid.
string.Format("HG UUID Gather for attachment {0} for {1}", so.Name, aCircuit.Name), base.HandleIncomingSceneObject(so, newPosition);
so.OwnerID.ToString(), }
o => else
{ {
string url = aCircuit.ServiceURLs["AssetServerURI"].ToString(); if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
// m_log.DebugFormat( {
// "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}", m_incomingSceneObjectEngine.QueueRequest(
// so.Name, so.AttachedAvatar, url); string.Format("HG UUID Gather for attachment {0} for {1}", so.Name, aCircuit.Name),
so.OwnerID.ToString(),
IteratingHGUuidGatherer uuidGatherer = new IteratingHGUuidGatherer(Scene.AssetService, url); o =>
uuidGatherer.RecordAssetUuids(so);
while (!uuidGatherer.Complete)
{ {
int tickStart = Util.EnvironmentTickCount(); string url = aCircuit.ServiceURLs["AssetServerURI"].ToString();
// m_log.DebugFormat(
// "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}",
// so.Name, so.AttachedAvatar, url);
UUID? nextUuid = uuidGatherer.NextUuidToInspect; IteratingHGUuidGatherer uuidGatherer = new IteratingHGUuidGatherer(Scene.AssetService, url);
uuidGatherer.GatherNext(); uuidGatherer.RecordAssetUuids(so);
// m_log.DebugFormat( while (!uuidGatherer.Complete)
// "[HG ENTITY TRANSFER]: Gathered attachment asset uuid {0} for object {1} for HG user {2} took {3} ms with asset service {4}",
// nextUuid, so.Name, so.OwnerID, Util.EnvironmentTickCountSubtract(tickStart), url);
int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart);
if (ticksElapsed > 30000)
{ {
m_log.WarnFormat( int tickStart = Util.EnvironmentTickCount();
"[HG ENTITY TRANSFER]: Removing incoming scene object jobs for HG user {0} as gather of {1} from {2} took {3} ms to respond (> {4} ms)",
so.OwnerID, so.Name, url, ticksElapsed, 30000);
RemoveIncomingSceneObjectJobs(so.OwnerID.ToString()); UUID? nextUuid = uuidGatherer.NextUuidToInspect;
uuidGatherer.GatherNext();
return; // m_log.DebugFormat(
} // "[HG ENTITY TRANSFER]: Gathered attachment asset uuid {0} for object {1} for HG user {2} took {3} ms with asset service {4}",
} // nextUuid, so.Name, so.OwnerID, Util.EnvironmentTickCountSubtract(tickStart), url);
IDictionary<UUID, sbyte> ids = uuidGatherer.GetGatheredUuids(); int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart);
// m_log.DebugFormat( if (ticksElapsed > 30000)
// "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset service {3}", {
// ids.Count, so.Name, so.OwnerID, url); m_log.WarnFormat(
"[HG ENTITY TRANSFER]: Removing incoming scene object jobs for HG user {0} as gather of {1} from {2} took {3} ms to respond (> {4} ms)",
so.OwnerID, so.Name, url, ticksElapsed, 30000);
foreach (KeyValuePair<UUID, sbyte> kvp in ids) RemoveIncomingSceneObjectJobs(so.OwnerID.ToString());
{
int tickStart = Util.EnvironmentTickCount();
uuidGatherer.FetchAsset(kvp.Key); return;
}
}
int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart); IDictionary<UUID, sbyte> ids = uuidGatherer.GetGatheredUuids();
if (ticksElapsed > 30000) // m_log.DebugFormat(
// "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset service {3}",
// ids.Count, so.Name, so.OwnerID, url);
foreach (KeyValuePair<UUID, sbyte> kvp in ids)
{ {
m_log.WarnFormat( int tickStart = Util.EnvironmentTickCount();
"[HG ENTITY TRANSFER]: Removing incoming scene object jobs for HG user {0} as fetch of {1} from {2} took {3} ms to respond (> {4} ms)",
so.OwnerID, kvp.Key, url, ticksElapsed, 30000);
RemoveIncomingSceneObjectJobs(so.OwnerID.ToString()); uuidGatherer.FetchAsset(kvp.Key);
return; int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart);
}
}
base.HandleIncomingSceneObject(so, newPosition); if (ticksElapsed > 30000)
{
m_log.WarnFormat(
"[HG ENTITY TRANSFER]: Removing incoming scene object jobs for HG user {0} as fetch of {1} from {2} took {3} ms to respond (> {4} ms)",
so.OwnerID, kvp.Key, url, ticksElapsed, 30000);
// m_log.DebugFormat( RemoveIncomingSceneObjectJobs(so.OwnerID.ToString());
// "[HG ENTITY TRANSFER MODULE]: Completed incoming attachment {0} for HG user {1} with asset server {2}",
// so.Name, so.OwnerID, url); return;
}, }
null); }
base.HandleIncomingSceneObject(so, newPosition);
// m_log.DebugFormat(
// "[HG ENTITY TRANSFER MODULE]: Completed incoming attachment {0} for HG user {1} with asset server {2}",
// so.Name, so.OwnerID, url);
},
null);
}
} }
} }