Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Floating licenses are now carrying the proper attributes

  • Loading branch information...
commit 835eea979b379c1abc7e5bb56b4a597b1bfe6102 1 parent 99b3b83
@ayende authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 Rhino.Licensing/LicensingService.cs
View
14 Rhino.Licensing/LicensingService.cs
@@ -156,14 +156,14 @@ private void WriteState(Stream stream)
{
Debug.WriteLine(id + " is already leased, so extending lease");
var licenseValidator = value.Value;
- return GenerateLicenseAndRenewLease(identifier, id, licenseValidator);
+ return GenerateLicenseAndRenewLease(identifier, id, licenseValidator, value.Value.LicenseAttributes);
}
if (availableLicenses.Count > 0)
{
var availableLicense = availableLicenses[availableLicenses.Count - 1];
availableLicenses.RemoveAt(availableLicenses.Count - 1);
Debug.WriteLine("Found available license to give, leasing it");
- return GenerateLicenseAndRenewLease(identifier, id, availableLicense);
+ return GenerateLicenseAndRenewLease(identifier, id, availableLicense, availableLicense.LicenseAttributes);
}
foreach (var kvp in leasedLicenses)
{
@@ -171,26 +171,26 @@ private void WriteState(Stream stream)
continue;
leasedLicenses.Remove(kvp.Key);
Debug.WriteLine("Found expired leased license, leasing it");
- return GenerateLicenseAndRenewLease(identifier, id, kvp.Value.Value);
+ return GenerateLicenseAndRenewLease(identifier, id, kvp.Value.Value, kvp.Value.Value.LicenseAttributes);
}
Debug.WriteLine("Could not find license to lease");
return null;
}
- private string GenerateLicenseAndRenewLease(string identifier, Guid id, LicenseValidator licenseValidator)
+ private string GenerateLicenseAndRenewLease(string identifier, Guid id, LicenseValidator licenseValidator, IDictionary<string, string> attributes)
{
leasedLicenses[identifier] = new KeyValuePair<DateTime, LicenseValidator>(DateTime.UtcNow.AddMinutes(30), licenseValidator);
using (var file = new FileStream(state, FileMode.Create, FileAccess.ReadWrite))
{
WriteState(file);
}
- return GenerateLicense(id, licenseValidator);
+ return GenerateLicense(id, licenseValidator, attributes);
}
- private static string GenerateLicense(Guid id, LicenseValidator validator)
+ private static string GenerateLicense(Guid id, LicenseValidator validator, IDictionary<string, string> attributes)
{
var generator = new LicenseGenerator(LicenseServerPrivateKey);
- return generator.Generate(validator.Name, id, DateTime.UtcNow.AddMinutes(45), LicenseType.Floating);
+ return generator.Generate(validator.Name, id, DateTime.UtcNow.AddMinutes(45), attributes ,LicenseType.Floating);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.