/// <summary>
 /// Creates a license validator with specfied public key.
 /// </summary>
 /// <param name="publicKey">public key</param>
 protected AbstractLicenseValidator(string publicKey)
 {
     LeaseTimeout = TimeSpan.FromMinutes(5);
     discoveryHost = new DiscoveryHost();
     LicenseAttributes = new Dictionary<string, string>();
     nextLeaseTimer = new Timer(LeaseLicenseAgain);
     this.publicKey = publicKey;
     this.senderId = Guid.NewGuid();
     discoveryHost.ClientDiscovered += DiscoveryHostOnClientDiscovered;
     discoveryHost.Start();
 }
        private void SetupDiscoveryHost(bool enableDiscovery)
        {
            DiscoveryEnabled = enableDiscovery;

            if (!enableDiscovery) return;

            senderId = Guid.NewGuid();
            discoveryHost = new DiscoveryHost();
            discoveryHost.ClientDiscovered += DiscoveryHostOnClientDiscovered;
            discoveryHost.Start();
        }
		/// <summary>
		/// Creates a license validator with specfied public key.
		/// </summary>
		/// <param name="publicKey">public key</param>
		protected AbstractLicenseValidator(string publicKey)
		{
			LeaseTimeout = TimeSpan.FromMinutes(5);
			discoveryHost = new DiscoveryHost();
			LicenseAttributes = new Dictionary<string, string>();
			nextLeaseTimer = new Timer(LeaseLicenseAgain);
			this.publicKey = publicKey;
			discoveryHost.ClientDiscovered += DiscoveryHostOnClientDiscovered;
			try
			{
				discoveryHost.Start();
			}
			catch (Exception e)
			{
				// we explicitly don't want bad things to happen if we can't do that
				Logger.ErrorException("Could not setup node discovery", e);
			}
		}