Changeset 1643


Ignore:
Timestamp:
Jun 15, 2010, 1:28:26 PM (12 years ago)
Author:
Paul Lelgemann
Message:

o Updated Peers@Play libraries
o Work on the distributed KeySearcher

Location:
trunk
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypP2P/Internal/P2PBase.cs

    r1642 r1643  
    147147                    break;
    148148                case P2PBootstrapperType.IrcBootstrapper:
    149                     // setup nat traversal stuff
    150                     LogToMonitor("Init Bootstrapper: Using NAT Traversal stuff");
    151                     PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.DelaySymmetricResponse = true;
    152                     PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.IncludeSymmetricInResponse = false;
    153                     PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.SymmetricResponseDelay = 6000;
    154 
    155149                    PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapperV2.Settings.DelaySymmetricResponse = true;
    156150                    PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapperV2.Settings.IncludeSymmetricResponse = false;
     151                    PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapperV2.Settings.UsePeerCache = false;
    157152
    158153                    _bootstrapper = new IrcBootstrapper(scheduler);
  • trunk/CrypPlugins/KeySearcher/KeySearcherSettings.cs

    r1634 r1643  
    22using System.Collections.Generic;
    33using System.Linq;
     4using System.Numerics;
    45using System.Text;
    56using Cryptool.PluginBase;
     
    2425
    2526            distributedJobIdentifier = Guid.NewGuid().ToString();
     27            chunkSize = 21;
    2628        }
    2729
     
    4143                    keysearcher.GuiLogMessage("Wrong key pattern!", NotificationLevel.Error);
    4244                HasChanges = true;
     45                OnPropertyChanged("TotalAmountOfChunks");
    4346            }
    4447        }
     
    117120
    118121        private int chunkSize;
    119         [TaskPane("Chunk size", "Amount of keys (x 10.000), that will be calculated by one peer at a time.", GroupPeerToPeer, 3, false, DisplayLevel.Professional,
    120             ControlType.NumericUpDown, ValidationType.RangeInteger, 250, int.MaxValue)]
     122        [TaskPane("Chunk size", "Amount of keys, that will be calculated by one peer at a time. This value is the exponent of the power of two used for the chunk size.", GroupPeerToPeer, 3, false, DisplayLevel.Professional,
     123            ControlType.NumericUpDown, ValidationType.RangeInteger, 1, 1000)]
    121124        public int ChunkSize
    122125        {
     
    128131                    chunkSize = value;
    129132                    OnPropertyChanged("ChunkSize");
    130                     HasChanges = true;
    131                 }
     133                    OnPropertyChanged("TotalAmountOfChunks");
     134                    HasChanges = true;
     135                }
     136            }
     137        }
     138
     139        [TaskPane("Amount of chunks", "Total number of chunks that must be calculated with the given chunk size.", GroupPeerToPeer, 4, false, DisplayLevel.Professional,
     140            ControlType.TextBox)]
     141        public double TotalAmountOfChunks
     142        {
     143            get {
     144                if (keysearcher.Pattern == null || !keysearcher.Pattern.testWildcardKey(key) || ChunkSize == 0)
     145                {
     146                    return 0;
     147                }
     148
     149                var keyPattern = new KeyPattern(keysearcher.ControlMaster.getKeyPattern());
     150                keyPattern.WildcardKey = key;
     151                var keyPatternPool = new KeyPatternPool(keyPattern, new BigInteger(Math.Pow(2, ChunkSize)));
     152                return (double) keyPatternPool.Length;
     153            }
     154            set
     155            {
     156                OnPropertyChanged("TotalAmountOfChunks");
    132157            }
    133158        }
  • trunk/CrypPlugins/KeySearcher/P2P/KeyPoolTree.cs

    r1634 r1643  
    1 using System.Collections.Generic;
     1using System;
     2using System.Collections.Generic;
    23using System.Numerics;
    34using KeySearcher.Helper;
     
    1718        private bool _skippedReservedNodes;
    1819        private bool _useReservedNodes;
     20        private BigInteger _lastPatternId;
    1921
    2022        public KeyPoolTree(KeyPatternPool patternPool, KeySearcherSettings settings, KeySearcher keySearcher, KeyQualityHelper keyQualityHelper)
     
    2527            _p2PHelper = new P2PHelper(keySearcher);
    2628            _skippedReservedNodes = false;
     29            _lastPatternId = -1;
     30
    2731            _rootNode = NodeFactory.CreateNode(_p2PHelper, keyQualityHelper, null, 0, _patternPool.Length - 1, _settings.DistributedJobIdentifier);
    2832
    29             _currentNode = _rootNode;
    3033            AdvanceToFirstLeaf();
    3134
     
    4144        private void AdvanceToFirstLeaf()
    4245        {
    43             _currentNode = _currentNode.CalculatableNode(true);
     46            _currentNode = _rootNode.CalculatableNode(false);
    4447        }
    4548
     
    101104
    102105            _currentNode = nextNode.CalculatableNode(_useReservedNodes);
     106
     107            if (((Leaf)_currentNode).PatternId() == _lastPatternId)
     108            {
     109                AdvanceToFirstLeaf();
     110            }
     111
    103112            _currentLeaf = (Leaf)_currentNode;
     113            _lastPatternId = CurrentPatternId();
    104114            return true;
    105115        }
  • trunk/CrypPlugins/KeySearcher/P2P/Nodes/NodeBase.cs

    r1634 r1643  
    6060            }
    6161
    62             // TODO eventuell wird nur der beste Eintrag übernommen?
    6362            foreach (var valueKey in revertedResults)
    6463            {
  • trunk/CrypPlugins/KeySearcher/P2P/P2PBruteForce.cs

    r1634 r1643  
    22using System.Collections.Generic;
    33using System.Linq;
     4using System.Numerics;
    45using System.Text;
    56using Cryptool.PluginBase;
     
    2829            }
    2930
    30             _patternPool = new KeyPatternPool(keyPattern, settings.ChunkSize * 10000);
     31            _patternPool = new KeyPatternPool(keyPattern, new BigInteger(Math.Pow(2, settings.ChunkSize)));
    3132            _keyPoolTree = new KeyPoolTree(_patternPool, _settings, _keySearcher, keyQualityHelper);
    3233
    3334            _keySearcher.GuiLogMessage(
    34                 "Total amount of patterns: " + _patternPool.Length + ", each containing " + settings.ChunkSize*10000 +
     35                "Total amount of patterns: " + _patternPool.Length + ", each containing " + _patternPool.PartSize +
    3536                " keys.", NotificationLevel.Debug);
    3637
  • trunk/CrypPlugins/P2PEditor/Distributed/DistributedJob.cs

    r1611 r1643  
    6767            if (rawWorkspaceData == null || rawWorkspaceData.Length == 0)
    6868            {
    69                 throw new NotSupportedException("Workspace data could not be fetching using Peer-to-peer.");
     69                throw new NotSupportedException("Workspace data could not be fetched using Peer-to-Peer system.");
    7070            }
    7171
  • trunk/CrypPlugins/P2PEditor/Distributed/JobListManager.cs

    r1616 r1643  
    102102        public void CompleteDistributedJob(DistributedJob distributedJob)
    103103        {
    104             if (File.Exists(distributedJob.LocalFilePath))
    105             {
    106                 _p2PEditor.GuiLogMessage("Local file exists, cannot complete job.", NotificationLevel.Error);
    107                 return;
    108             }
    109 
    110104            distributedJob.ConvertRawWorkspaceToLocalFile(P2PManager.Retrieve(GenerateWorkspaceKey(distributedJob)));
    111105        }
  • trunk/CrypPlugins/P2PEditor/Worker/JobParticipationWorker.cs

    r1549 r1643  
    2929            {
    3030                _jobListManager.CompleteDistributedJob(_jobToParticipateIn);
    31             } catch(ArgumentOutOfRangeException ex)
     31            } catch(Exception ex)
    3232            {
    3333                _p2PEditor.GuiLogMessage("Error completing job: " + ex.Message, NotificationLevel.Error);
  • trunk/CrypPlugins/PeerToPeerBase/P2PBase.cs

    r1433 r1643  
    182182                    settings.LocalReceivingPort = 0;
    183183                    settings.UseLocalAddressDetection = false;
    184                     settings.AutoReconnect = false;
    185184                    settings.NoDelay = false;
    186185                    settings.ReuseAddress = false;
Note: See TracChangeset for help on using the changeset viewer.