Ignore:
Timestamp:
May 31, 2010, 7:22:34 PM (12 years ago)
Author:
Paul Lelgemann
Message:

o CrypP2P: refactored P2PBase, removed race condition and unused code

Location:
trunk/CrypPlugins/P2PEditor
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/P2PEditor/Distributed/DistributedJob.cs

    r1530 r1545  
    6868            info.AddValue("JobDescription", JobDescription);
    6969            info.AddValue("JobGuid", JobGuid);
    70             info.AddValue("JobOwner", P2PManager.Instance.P2PSettings.PeerName);
     70            info.AddValue("JobOwner", P2PSettings.Default.PeerName);
    7171            info.AddValue("JobDate", DateTime.Now);
    7272            info.AddValue("FileName", Path.GetFileName(LocalFilePath));
     
    7777        public void ConvertRawWorkspaceToLocalFile(byte[] rawWorkspaceData)
    7878        {
    79             string workspacePath = P2PManager.Instance.P2PSettings.WorkspacePath;
     79            string workspacePath = P2PSettings.Default.WorkspacePath;
    8080            if (String.IsNullOrEmpty(workspacePath) || !Directory.Exists(workspacePath))
    8181            {
    82                 throw new ArgumentOutOfRangeException(workspacePath, "Workspace path is null, empty or does not exist.");
     82                throw new ArgumentOutOfRangeException(workspacePath, "Configured workspace directory is null, empty or does not exist.");
    8383            }
    8484
     
    9393            if (rawWorkspaceData == null || rawWorkspaceData.Length == 0)
    9494            {
    95                 throw new ArgumentOutOfRangeException(LocalFilePath, "Workspace could not be fetching using Peer-to-peer.");
     95                throw new NotSupportedException("Workspace data could not be fetching using Peer-to-peer.");
    9696            }
    9797
  • trunk/CrypPlugins/P2PEditor/Distributed/JobListManager.cs

    r1530 r1545  
    1 using System;
    2 using System.Collections.Generic;
     1using System.Collections.Generic;
    32using System.IO;
    43using System.Runtime.Serialization.Formatters.Binary;
     
    2322            _p2PEditor.GuiLogMessage("Fetching DHT job list...", NotificationLevel.Debug);
    2423
    25             if (!P2PManager.Instance.P2PConnected())
     24            if (!P2PManager.Instance.IsP2PConnected())
    2625            {
    2726                _p2PEditor.GuiLogMessage("P2P not connected, cannot fetch job list.", NotificationLevel.Error);
     
    4847            _p2PEditor.GuiLogMessage("Distributing new job...", NotificationLevel.Debug);
    4948
    50             if (!P2PManager.Instance.P2PConnected())
     49            if (!P2PManager.Instance.IsP2PConnected())
    5150            {
    5251                _p2PEditor.GuiLogMessage("P2P not connected, cannot distribute job.", NotificationLevel.Error);
  • trunk/CrypPlugins/P2PEditor/GUI/P2PEditorPresentation.xaml.cs

    r1538 r1545  
    6464        private void UpdateConnectionState()
    6565        {
    66             IsP2PConnected = P2PManager.Instance.P2PConnected();
     66            IsP2PConnected = P2PManager.Instance.IsP2PConnected();
    6767        }
    6868
     
    8787        private void UpdateDisplay()
    8888        {
    89             IsP2PConnected = P2PManager.Instance.P2PConnected();
     89            IsP2PConnected = P2PManager.Instance.IsP2PConnected();
    9090            Jobs = JobListManager.JobList();
    9191        }
  • trunk/CrypPlugins/P2PEditor/P2PEditor.cs

    r1527 r1545  
    127127        public bool CanExecute
    128128        {
    129             get { return !P2PManager.Instance.P2PConnected() && !P2PManager.Instance.IsP2PConnecting; }
     129            get { return !P2PManager.Instance.IsP2PConnected() && !P2PManager.Instance.IsP2PConnecting; }
    130130        }
    131131
     
    133133        {
    134134            // TODO design problem? when set to true, CrypWin will terminate execute Stop() (and terminate the P2P connection) when switching back to an AnotherEditor instance
    135             // get { return P2PManager.Instance.P2PConnected() && !P2PManager.Instance.IsP2PConnecting; }
     135            // get { return P2PManager.Instance.IsP2PConnected() && !P2PManager.Instance.IsP2PConnecting; }
    136136            get { return false; }
    137137        }
     
    175175        private void RunConnectionWorker()
    176176        {
    177             var connectionWorker = new ConnectionWorker(P2PManager.Instance.P2PBase, P2PManager.Instance.P2PSettings);
     177            var connectionWorker = new ConnectionWorker(P2PManager.Instance.P2PBase);
    178178            connectionWorker.BackgroundWorker.RunWorkerCompleted += ((P2PEditorPresentation) Presentation).ConnectionWorkerCompleted;
    179179            connectionWorker.Start();
  • trunk/CrypPlugins/P2PEditor/P2PEditorSettings.cs

    r1527 r1545  
    3333        {
    3434            _p2PEditor = p2PEditor;
    35             _settings = P2PManager.Instance.P2PSettings;
     35            _settings = P2PSettings.Default;
    3636        }
    3737
     
    114114        public void BtnStop()
    115115        {
    116             if (P2PManager.Instance.P2PConnected() && !P2PManager.Instance.IsP2PConnecting)
    117             {
    118                 new ConnectionWorker(P2PManager.Instance.P2PBase, P2PManager.Instance.P2PSettings).Start();
     116            if (P2PManager.Instance.IsP2PConnected() && !P2PManager.Instance.IsP2PConnecting)
     117            {
     118                new ConnectionWorker(P2PManager.Instance.P2PBase).Start();
    119119                OnPropertyChanged("BtnStop");
    120120            }
     
    127127        {
    128128            var logMsg = string.Format("Connection established: {0} / Currently connecting: {1} / Peer ID: {2}",
    129                                        P2PManager.Instance.P2PConnected(), P2PManager.Instance.IsP2PConnecting,
     129                                       P2PManager.Instance.IsP2PConnected(), P2PManager.Instance.IsP2PConnecting,
    130130                                       P2PManager.Instance.UserInfo());
    131131            _p2PEditor.GuiLogMessage(logMsg, NotificationLevel.Info);
     
    221221            }
    222222
    223             P2PManager.Instance.P2PSettings.Save();
     223            P2PSettings.Default.Save();
    224224        }
    225225    }
Note: See TracChangeset for help on using the changeset viewer.