diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 96 |
1 files changed, 78 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index be409bb..7e356ea 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -546,6 +546,31 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
546 | } | 546 | } |
547 | } | 547 | } |
548 | 548 | ||
549 | private void RemoveIncomingSceneObjectJobs(string commonIdToRemove) | ||
550 | { | ||
551 | List<Job> jobsToReinsert = new List<Job>(); | ||
552 | int jobsRemoved = 0; | ||
553 | |||
554 | Job job; | ||
555 | while ((job = m_incomingSceneObjectEngine.RemoveNextRequest()) != null) | ||
556 | { | ||
557 | if (job.CommonId != commonIdToRemove) | ||
558 | jobsToReinsert.Add(job); | ||
559 | else | ||
560 | jobsRemoved++; | ||
561 | } | ||
562 | |||
563 | m_log.DebugFormat( | ||
564 | "[HG ENTITY TRANSFER]: Removing {0} jobs with common ID {1} and reinserting {2} other jobs", | ||
565 | jobsRemoved, commonIdToRemove, jobsToReinsert.Count); | ||
566 | |||
567 | if (jobsToReinsert.Count > 0) | ||
568 | { | ||
569 | foreach (Job jobToReinsert in jobsToReinsert) | ||
570 | m_incomingSceneObjectEngine.QueueRequest(jobToReinsert); | ||
571 | } | ||
572 | } | ||
573 | |||
549 | public override bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition) | 574 | public override bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition) |
550 | { | 575 | { |
551 | // FIXME: We must make it so that we can use SOG.IsAttachment here. At the moment it is always null! | 576 | // FIXME: We must make it so that we can use SOG.IsAttachment here. At the moment it is always null! |
@@ -564,38 +589,73 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
564 | { | 589 | { |
565 | m_incomingSceneObjectEngine.QueueRequest( | 590 | m_incomingSceneObjectEngine.QueueRequest( |
566 | string.Format("HG UUID Gather for attachment {0} for {1}", so.Name, aCircuit.Name), | 591 | string.Format("HG UUID Gather for attachment {0} for {1}", so.Name, aCircuit.Name), |
592 | so.OwnerID.ToString(), | ||
567 | o => | 593 | o => |
568 | { | 594 | { |
569 | string url = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | 595 | string url = aCircuit.ServiceURLs["AssetServerURI"].ToString(); |
570 | m_log.DebugFormat( | 596 | // m_log.DebugFormat( |
571 | "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset server {2}", | 597 | // "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}", |
572 | so.Name, so.AttachedAvatar, url); | 598 | // so.Name, so.AttachedAvatar, url); |
573 | 599 | ||
574 | IteratingHGUuidGatherer uuidGatherer = new IteratingHGUuidGatherer(Scene.AssetService, url); | 600 | IteratingHGUuidGatherer uuidGatherer = new IteratingHGUuidGatherer(Scene.AssetService, url); |
575 | uuidGatherer.RecordAssetUuids(so); | 601 | uuidGatherer.RecordAssetUuids(so); |
576 | 602 | ||
577 | // XXX: We will shortly use this iterating mechanism to check if a fetch is taking too long | 603 | while (!uuidGatherer.Complete) |
578 | // but just for now we will simply fetch everything. If this was permanent could use | 604 | { |
579 | // GatherAll() | 605 | int tickStart = Util.EnvironmentTickCount(); |
580 | while (uuidGatherer.GatherNext()) | 606 | |
581 | m_log.DebugFormat( | 607 | UUID? nextUuid = uuidGatherer.NextUuidToInspect; |
582 | "[HG ENTITY TRANSFER]: Gathered attachment {0} for HG user {1} with asset server {2}", | 608 | uuidGatherer.GatherNext(); |
583 | so.Name, so.OwnerID, url); | 609 | |
610 | // m_log.DebugFormat( | ||
611 | // "[HG ENTITY TRANSFER]: Gathered attachment asset uuid {0} for object {1} for HG user {2} took {3} ms with asset service {4}", | ||
612 | // nextUuid, so.Name, so.OwnerID, Util.EnvironmentTickCountSubtract(tickStart), url); | ||
613 | |||
614 | int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart); | ||
615 | |||
616 | if (ticksElapsed > 30000) | ||
617 | { | ||
618 | m_log.WarnFormat( | ||
619 | "[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)", | ||
620 | so.OwnerID, so.Name, url, ticksElapsed, 30000); | ||
621 | |||
622 | RemoveIncomingSceneObjectJobs(so.OwnerID.ToString()); | ||
623 | |||
624 | return; | ||
625 | } | ||
626 | } | ||
584 | 627 | ||
585 | IDictionary<UUID, sbyte> ids = uuidGatherer.GetGatheredUuids(); | 628 | IDictionary<UUID, sbyte> ids = uuidGatherer.GetGatheredUuids(); |
586 | 629 | ||
587 | m_log.DebugFormat( | 630 | // m_log.DebugFormat( |
588 | "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset server {3}", | 631 | // "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset service {3}", |
589 | ids.Count, so.Name, so.OwnerID, url); | 632 | // ids.Count, so.Name, so.OwnerID, url); |
590 | 633 | ||
591 | foreach (KeyValuePair<UUID, sbyte> kvp in ids) | 634 | foreach (KeyValuePair<UUID, sbyte> kvp in ids) |
592 | uuidGatherer.FetchAsset(kvp.Key); | 635 | { |
636 | int tickStart = Util.EnvironmentTickCount(); | ||
637 | |||
638 | uuidGatherer.FetchAsset(kvp.Key); | ||
639 | |||
640 | int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart); | ||
641 | |||
642 | if (ticksElapsed > 30000) | ||
643 | { | ||
644 | m_log.WarnFormat( | ||
645 | "[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)", | ||
646 | so.OwnerID, kvp.Key, url, ticksElapsed, 30000); | ||
647 | |||
648 | RemoveIncomingSceneObjectJobs(so.OwnerID.ToString()); | ||
649 | |||
650 | return; | ||
651 | } | ||
652 | } | ||
593 | 653 | ||
594 | base.HandleIncomingSceneObject(so, newPosition); | 654 | base.HandleIncomingSceneObject(so, newPosition); |
595 | 655 | ||
596 | m_log.DebugFormat( | 656 | // m_log.DebugFormat( |
597 | "[HG ENTITY TRANSFER MODULE]: Completed incoming attachment {0} for HG user {1} with asset server {2}", | 657 | // "[HG ENTITY TRANSFER MODULE]: Completed incoming attachment {0} for HG user {1} with asset server {2}", |
598 | so.Name, so.OwnerID, url); | 658 | // so.Name, so.OwnerID, url); |
599 | }, | 659 | }, |
600 | null); | 660 | null); |
601 | } | 661 | } |