Ignore:
Timestamp:
Jan 19, 2010, 1:11:42 PM (12 years ago)
Author:
arnold
Message:

Buggy P2PManager/Worker classes - don't use at present!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/PeerToPeerPublisher/P2PPublisherBase.cs

    r1068 r1090  
    2121        #region Variables
    2222
    23         private const string DHT_ALIVE_POSTFIX = "AliveMsg";
    24 
    2523        protected IP2PControl p2pControl;
    2624        protected SubscriberManagement peerManagement;
     
    7876
    7977            // before storing the publishers ID in the DHT, proof whether there already exists an entry
    80             byte[] byRead = this.p2pControl.DHTload(sTopic);
     78            PeerId byRead = DHT_CommonManagement.GetTopicsPublisherId(ref this.p2pControl, sTopic);
     79
    8180            // if byRead is not null, the DHT entry was already written
    8281            if (byRead != null)
    8382            {
    84                 PeerId peerRead = this.p2pControl.GetPeerID(byRead);
    85 
    86                 // if sRead equals sPeerId this Publisher with the same topic had written
    87                 // this entry - no problem! Otherwise abort Starting the publisher!
    88                 if (peerRead != myPeerId)
     83                // this entry? Then no problem! Otherwise abort Starting the publisher!
     84                if (byRead != myPeerId)
    8985                {
    9086                    GuiLogging("Can't store Publisher in the DHT because the Entry was already occupied.", NotificationLevel.Error);
     
    9490            /* END: CHECKING WHETHER THERE HAS ALREADY EXIST ANOTHER PUBLISHER */
    9591
    96             bool bolTopicStored = this.p2pControl.DHTstore(sTopic, myPeerId.ToByteArray());
    97             bool bolSettingsStored = this.p2pControl.DHTstore(sTopic + DHT_ALIVE_POSTFIX,
    98                 System.BitConverter.GetBytes(this.aliveMessageInterval));
     92            bool bolTopicStored = DHT_CommonManagement.SetTopicsPublisherId(ref this.p2pControl, sTopic, myPeerId);
     93            bool bolSettingsStored = DHT_CommonManagement.SetAliveMessageInterval(ref this.p2pControl, sTopic, this.aliveMessageInterval);
    9994
    10095            if (!bolTopicStored || !bolSettingsStored)
     
    140135                GuiLogging("Begin removing the information from the DHT", NotificationLevel.Debug);
    141136
    142                 bool removeTopic = this.p2pControl.DHTremove(this.topic);
    143                 bool removeSettings = this.p2pControl.DHTremove(this.topic + DHT_ALIVE_POSTFIX);
    144                 string removeInfo = String.Empty;
    145                 if (removeTopic && removeSettings)
    146                     removeInfo = "Topic and settings";
    147                 else if (removeTopic)
    148                     removeInfo = "Topic";
    149                 else if (removeSettings)
    150                     removeInfo = "Settings";
    151                 if (removeInfo != String.Empty)
    152                     GuiLogging(removeInfo + " successfully removed from DHT.", NotificationLevel.Debug);
     137                bool removeSettings = DHT_CommonManagement.DeleteAllPublishersEntries(ref this.p2pControl, this.topic);
     138
     139                if (removeSettings)
     140                    GuiLogging("Publishers/Managers ID and Alive Message Interval successfully removed from DHT.", NotificationLevel.Debug);
    153141                else
    154142                    GuiLogging("Neither Topic nor settings were removed from DHT.", NotificationLevel.Debug);
Note: See TracChangeset for help on using the changeset viewer.