Ignore:
Timestamp:
Feb 13, 2010, 7:56:47 PM (12 years ago)
Author:
arnold
Message:

P2PManager/P2PJobAdmin: Finetuning of leaving and re-joining the network.
Miscellaneous null-Checks implemented, so some p2p-sided errors where catched.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/PeerToPeerManager_NEW/P2PManagerBase_NEW.cs

    r1137 r1144  
    116116        }
    117117
    118         public bool StartManager(string sTopic, long aliveMessageInterval)
    119         {
    120             bool result = false;
     118        public void StartManager(string sTopic, long aliveMessageInterval)
     119        {
    121120            // only when the main manager plugin is connected with a Peer-PlugIn
    122121            // and a IWorkerControl-PlugIn, this Manager can start its work
     
    125124                this.TopicName = sTopic;
    126125                this.AliveMesageInterval = aliveMessageInterval;
    127                 result = base.Start(this.TopicName, this.AliveMesageInterval);
    128 
    129                 this.ManagerStarted = result;
    130 
    131                 GetProgressInformation();
    132             }
    133             GuiLogging("P2PManager starting status: " + result.ToString(), NotificationLevel.Info);
    134             return result;
     126                base.Start(this.TopicName, this.AliveMesageInterval);
     127            }
     128            else
     129            {
     130                GuiLogging("Manager can't be started, because P2P-Peer- or Distributable-Job-PlugIn isn't connected with the Manager or the connection is broken...", NotificationLevel.Warning);
     131            }
     132        }
     133
     134        protected override void PeerCompletelyStarted()
     135        {
     136            base.PeerCompletelyStarted();
     137
     138            this.ManagerStarted = true;
     139            GetProgressInformation();
     140            GuiLogging("P2PManager is started right now.", NotificationLevel.Info);
    135141        }
    136142
     
    141147            this.ManagerStarted = false;
    142148            ((WorkersManagement)this.peerManagement).OnFreeWorkersAvailable -= peerManagement_OnFreeWorkersAvailable;
    143 
    144             GuiLogging("P2PManager was stopped successully", NotificationLevel.Info);
     149            ((WorkersManagement)this.peerManagement).OnSubscriberRemoved -= peerManagement_OnSubscriberRemoved;
     150
     151            GuiLogging("P2PManager was stopped successully.", NotificationLevel.Info);
    145152        }
    146153
     
    313320        private void peerManagement_OnFreeWorkersAvailable()
    314321        {
    315             if (!this.managerStarted)
     322            if (!this.ManagerStarted)
    316323            {
    317324                GuiLogging("Manager isn't started at present, so I can't disperse the patterns.", NotificationLevel.Error);
    318                 throw (new Exception("Critical error in P2PManager. Manager isn't started yet, but the workers can register..."));
    319             }
    320 
    321             AllocateJobs();
     325                bool removeSettings = DHT_CommonManagement.DeleteAllPublishersEntries(ref this.p2pControl, this.TopicName);
     326                if (removeSettings)
     327                    GuiLogging("Manager is stopped, but DHT entries were still existing, so they were deleted!", NotificationLevel.Info);
     328                else
     329                    throw (new Exception("Critical error in P2PManager. Manager isn't started yet, but the workers can register... Even removing DHT entries weren't possible..."));
     330            }
     331            else
     332                AllocateJobs();
    322333
    323334            GetProgressInformation();
Note: See TracChangeset for help on using the changeset viewer.