Ignore:
Timestamp:
Jun 3, 2010, 3:46:05 PM (12 years ago)
Author:
Paul Lelgemann
Message:

+ P2PEditor: Timer-based refresh of the job list (configurable in seconds)
o CrypP2P: Restored bootstrapper to V2
+ P2PManager: Added asynchronous DHT message calls for completeness

File:
1 edited

Legend:

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

    r1578 r1579  
    1818using System.Text;
    1919using System.Threading;
     20using Cryptool.PluginBase;
    2021using Cryptool.Plugins.PeerToPeer.Internal;
    2122using Gears4Net;
     
    2627using PeersAtPlay.P2POverlay;
    2728using PeersAtPlay.P2POverlay.Bootstrapper;
    28 using PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper;
     29using PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapperV2;
    2930using PeersAtPlay.P2POverlay.Bootstrapper.LocalMachineBootstrapper;
    3031using PeersAtPlay.P2POverlay.FullMeshOverlay;
     
    3233using PeersAtPlay.P2PStorage.FullMeshDHT;
    3334using PeersAtPlay.Util.Logging;
    34 using Settings = PeersAtPlay.P2PLink.SnalNG.Settings;
    3535
    3636/* TODO:
     
    5252        private readonly AutoResetEvent _systemLeft;
    5353        private IBootstrapper _bootstrapper;
    54         private IDHT _dht;
    5554        private IP2PLinkManager _linkmanager;
    5655        private P2POverlay _overlay;
    57         private IVersionedDHT _versionedDht;
     56        internal IDHT Dht;
     57        internal IVersionedDHT VersionedDht;
    5858
    5959        /// <summary>
     
    108108                    _linkmanager = new Snal(scheduler);
    109109
    110                     var settings = new Settings();
     110                    var settings = new PeersAtPlay.P2PLink.SnalNG.Settings();
    111111                    settings.LoadDefaults();
    112112                    settings.ConnectInternal = true;
    113                     settings.LocalReceivingPort = 0;
     113                    settings.LocalReceivingPort = P2PSettings.Default.LocalPort;
    114114                    settings.UseLocalAddressDetection = false;
    115115                    settings.AutoReconnect = false;
     
    138138                    PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.IncludeSymmetricInResponse = false;
    139139                    PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.SymmetricResponseDelay = 6000;
     140                   
     141                    PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapperV2.Settings.DelaySymmetricResponse = true;
     142                    PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapperV2.Settings.IncludeSymmetricResponse = false;
    140143
    141144                    _bootstrapper = new IrcBootstrapper(scheduler);
     
    158161            {
    159162                case P2PDHTType.FullMeshDHT:
    160                     _dht = new FullMeshDHT(scheduler);
     163                    Dht = new FullMeshDHT(scheduler);
    161164                    break;
    162165                default:
     
    165168
    166169            _overlay.MessageReceived += OverlayMessageReceived;
    167             _dht.SystemJoined += OnDhtSystemJoined;
    168             _dht.SystemLeft += OnDhtSystemLeft;
    169 
    170             _versionedDht = (IVersionedDHT) _dht;
    171 
    172             _dht.Initialize(P2PSettings.Default.PeerName, string.Empty, P2PSettings.Default.WorldName, _overlay,
     170            Dht.SystemJoined += OnDhtSystemJoined;
     171            Dht.SystemLeft += OnDhtSystemLeft;
     172
     173            VersionedDht = (IVersionedDHT) Dht;
     174
     175            Dht.Initialize(P2PSettings.Default.PeerName, string.Empty, P2PSettings.Default.WorldName, _overlay,
    173176                            _bootstrapper,
    174177                            _linkmanager, null);
     
    199202            }
    200203
    201             _dht.BeginStart(null);
     204            Dht.BeginStart(null);
    202205
    203206            // Wait for event SystemJoined. When it's invoked, the peer completely joined the P2P system
     
    213216        public bool SynchStop()
    214217        {
    215             if (_dht == null) return false;
    216 
    217             _dht.BeginStop(null);
     218            if (Dht == null) return false;
     219
     220            Dht.BeginStop(null);
    218221
    219222            // wait till systemLeft Event is invoked
     
    333336
    334337            var responseWait = new ResponseWait {WaitHandle = autoResetEvent, key = key, value = data};
    335             _versionedDht.Store(OnSynchStoreCompleted, key, data, responseWait);
     338            VersionedDht.Store(OnSynchStoreCompleted, key, data, responseWait);
    336339
    337340            // blocking till response
     
    387390            var autoResetEvent = new AutoResetEvent(false);
    388391            var responseWait = new ResponseWait {WaitHandle = autoResetEvent, key = key};
    389             _dht.Retrieve(OnSynchRetrieveCompleted, key, responseWait);
     392            Dht.Retrieve(OnSynchRetrieveCompleted, key, responseWait);
    390393
    391394            // blocking till response
     
    445448            var autoResetEvent = new AutoResetEvent(false);
    446449            var responseWait = new ResponseWait {WaitHandle = autoResetEvent, key = key};
    447             _versionedDht.Remove(OnSynchRemoveCompleted, key, responseWait);
     450            VersionedDht.Remove(OnSynchRemoveCompleted, key, responseWait);
    448451
    449452            // blocking till response
     
    486489        public void LogInternalState()
    487490        {
    488             if (_dht != null)
    489             {
    490                 _dht.LogInternalState();
     491            if (Dht != null)
     492            {
     493                Dht.LogInternalState();
    491494            }
    492495        }
Note: See TracChangeset for help on using the changeset viewer.