Ignore:
Timestamp:
Oct 28, 2010, 9:37:42 PM (11 years ago)
Author:
Sven Rech
Message:

distributed key searcher fixes:

  • Gives reservation free if you click stop.
  • Reservation of current leave every five minutes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/KeySearcher/P2P/Tree/Leaf.cs

    r2019 r2024  
    1313        private bool isLeafReserved;
    1414        private const int RESERVATIONTIMEOUT = 30;
    15         //--------------------------------------------------------------------------------------------
    16         private long clientIdentifier = Cryptool.PluginBase.Miscellaneous.UniqueIdentifier.GetID();
    17         //--------------------------------------------------------------------------------------------
     15        private long clientIdentifier = -1;
    1816
    1917        public Leaf(StorageHelper storageHelper, KeyQualityHelper keyQualityHelper, Node parentNode, BigInteger id, string distributedJobIdentifier)
     
    6159        {
    6260            LastReservationDate = DateTime.UtcNow;
     61            clientIdentifier = Cryptool.PluginBase.Miscellaneous.UniqueIdentifier.GetID();
    6362            return StorageHelper.UpdateInDht(this).IsSuccessful();
    6463        }
    6564
    66         public override bool IsReserverd()
     65        public void GiveLeaveFree()
     66        {
     67            StorageHelper.UpdateFromDht((this));
     68            //Only give leaf free, if the reservation is still ours:
     69            if (clientIdentifier == Cryptool.PluginBase.Miscellaneous.UniqueIdentifier.GetID())
     70            {
     71                LastReservationDate = new DateTime(0);
     72                clientIdentifier = -1;
     73                isLeafReserved = false;
     74                StorageHelper.UpdateInDht(this);
     75            }
     76        }
     77
     78        public override bool IsReserved()
    6779        {
    6880            return isLeafReserved;
Note: See TracChangeset for help on using the changeset viewer.