Changeset 2015


Ignore:
Timestamp:
Oct 24, 2010, 11:18:09 PM (11 years ago)
Author:
Paul Lelgemann
Message:

+ P2P-KeySearcher tree search optimizations can be disabled by uncommenting the REMOVEME-line, it will reload the tree for every search
o Minor refactoring for search method, now using an enum-parameter
o Fix: P2P editor will no longer show the "Participating..." adorner after the workspace has been launched

Location:
trunk/CrypPlugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/KeySearcher/P2P/Tree/KeyPoolTree.cs

    r1751 r2015  
    2525        private NodeBase currentNode;
    2626        private bool skippedReservedNodes;
     27
     28        private enum SearchOption { UseReservedLeafs, SkipReservedLeafs }
    2729
    2830        public KeyPoolTree(KeyPatternPool patternPool, KeySearcher keySearcher, KeyQualityHelper keyQualityHelper, StorageKeyGenerator identifierGenerator, StatusContainer statusContainer, StatisticsGenerator statisticsGenerator)
     
    5456        public Leaf FindNextLeaf()
    5557        {
     58            // REMOVEME uncommenting the next line will cause a search for the next free pattern starting from the root node - for every leaf!
     59            //Reset();
     60
    5661            statusContainer.IsSearchingForReservedNodes = false;
    5762            statisticsGenerator.MarkStartOfNodeSearch();
    5863
    5964            var nodeBeforeStarting = currentNode;
    60             var foundNode = FindNextLeaf(false);
     65            var foundNode = FindNextLeaf(SearchOption.SkipReservedLeafs);
    6166
    6267            if (foundNode == null && skippedReservedNodes)
     
    6671                currentNode = nodeBeforeStarting;
    6772                statusContainer.IsSearchingForReservedNodes = true;
    68                 foundNode = FindNextLeaf(true);
     73                foundNode = FindNextLeaf(SearchOption.UseReservedLeafs);
    6974                currentNode = foundNode;
    7075
     
    7984        }
    8085
    81         private Leaf FindNextLeaf(bool useReservedLeafs)
     86        private Leaf FindNextLeaf(SearchOption useReservedLeafsOption)
    8287        {
    8388            if (currentNode == null)
    84             {
    8589                return null;
    86             }
    8790
    8891            var isReserved = false;
     92            var useReservedLeafs = useReservedLeafsOption == SearchOption.UseReservedLeafs;
     93
    8994            storageHelper.UpdateFromDht(currentNode, true);
    9095            currentNode.UpdateCache();
  • trunk/CrypPlugins/P2PEditor/GUI/Controls/JobDisplay.xaml.cs

    r1917 r2015  
    165165                              jobToParticipateIn.Guid),
    166166                NotificationLevel.Info);
    167             new JobParticipationWorker(P2PEditor, JobListManager, jobToParticipateIn, Dispatcher).RunWorkerAsync();
     167            var jobParticipationWorker = new JobParticipationWorker(P2PEditor, JobListManager, jobToParticipateIn, Dispatcher);
     168            jobParticipationWorker.RunWorkerCompleted +=JobParticipationWorkerRunWorkerCompleted;
     169            jobParticipationWorker.RunWorkerAsync();
     170        }
     171
     172        private void JobParticipationWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
     173        {
     174            Participating = false;
    168175        }
    169176
Note: See TracChangeset for help on using the changeset viewer.