Skip to content

Commit

Permalink
Merge branch 'release-4.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasohlund committed Dec 5, 2013
2 parents ee3d0fe + 83f65dd commit 21092c7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 29 deletions.
Expand Up @@ -13,7 +13,8 @@ public class TrialLicenseReaderTests
public void When_no_sub_key_exists_one_is_created()
{
var subKeyPath = String.Format(@"SOFTWARE\NServiceBus\{0}", NServiceBusVersion.MajorAndMinor);
Registry.CurrentUser.DeleteSubKey(subKeyPath);

Registry.CurrentUser.DeleteSubKey(subKeyPath,false);
var expirationFromRegistry = TrialLicenseReader.GetTrialExpirationFromRegistry();
Assert.AreEqual(DateTime.UtcNow.AddDays(TrialLicenseReader.TRIAL_DAYS).Date, expirationFromRegistry.Date);
Assert.IsNotNull(Registry.CurrentUser.OpenSubKey(subKeyPath));
Expand Down
25 changes: 18 additions & 7 deletions src/NServiceBus.Core/Licensing/LicenseManager.cs
Expand Up @@ -32,7 +32,7 @@ internal static void PromptUserForLicenseIfTrialHasExpired()
//TODO: should we display dialog if UpgradeProtection is not valid?
if (ExpiryChecker.IsExpired(License.ExpirationDate))
{
License = LicenseExpiredFormDisplayer.PromptUserForLicense();
license = LicenseExpiredFormDisplayer.PromptUserForLicense();
}
}
}
Expand All @@ -58,22 +58,22 @@ static void ConfigureNServiceBusToRunInTrialMode()
{
Logger.WarnFormat("Trial for NServiceBus v{0} has expired. Falling back to run in Basic1 license mode.", NServiceBusVersion.MajorAndMinor);

License = LicenseDeserializer.GetBasicLicense();
license = LicenseDeserializer.GetBasicLicense();
}
else
{
var message = string.Format("Trial for NServiceBus v{0} is still active, trial expires on {1}. Configuring NServiceBus to run in trial mode.", NServiceBusVersion.MajorAndMinor, trialExpirationDate.ToLocalTime().ToShortDateString());
Logger.Info(message);

//Run in unlimited mode during trial period
License = LicenseDeserializer.GetTrialLicense(trialExpirationDate);
license = LicenseDeserializer.GetTrialLicense(trialExpirationDate);
}
return;
}

Logger.Warn("Could not access registry for the current user sid. Falling back to run in Basic license mode.");

License = LicenseDeserializer.GetBasicLicense();
license = LicenseDeserializer.GetBasicLicense();
}

internal static void Verify()
Expand All @@ -96,18 +96,29 @@ internal static void Verify()
{
message = message + " You can renew it at http://particular.net/licensing. Downgrading to basic mode";
Logger.Warn(message);
License = LicenseDeserializer.GetBasicLicense();
license = LicenseDeserializer.GetBasicLicense();
}
else
{
License = tempLicense;
license = tempLicense;
}
WriteLicenseInfo();
}

static ILog Logger = LogManager.GetLogger(typeof(LicenseManager));

public static License License;
public static License License
{
get
{
if (license == null)
{
Verify();
}
return license;
}
}
static string licenseText;
static License license;
}
}
11 changes: 0 additions & 11 deletions src/NServiceBus.Core/Licensing/LicenseVerifier.cs

This file was deleted.

1 change: 0 additions & 1 deletion src/NServiceBus.Core/NServiceBus.Core.csproj
Expand Up @@ -122,7 +122,6 @@
<Compile Include="Impersonation\Windows\ConfigureWindowsIdentityEnricher.cs" />
<Compile Include="Installation\GatewayHttpListenerInstaller.cs" />
<Compile Include="Installation\ElevateChecker.cs" />
<Compile Include="Licensing\LicenseVerifier.cs" />
<Compile Include="Licensing\ExpiryChecker.cs" />
<Compile Include="Licensing\LicenseDowngrader.cs" />
<Compile Include="Licensing\LicenseLocationConventions.cs" />
Expand Down
Expand Up @@ -6,6 +6,7 @@
using Logging;
using Pipeline;
using Pipeline.Contexts;
using Transport;

class ExecuteLogicalMessagesBehavior : IBehavior<ReceivePhysicalMessageContext>
{
Expand All @@ -25,9 +26,13 @@ public void Invoke(ReceivePhysicalMessageContext context, Action next)
PipelineFactory.InvokeLogicalMessagePipeline(message);
}

if (!logicalMessages.Any())

if (!context.PhysicalMessage.IsControlMessage())
{
log.Warn("Received an empty message - ignoring.");
if (!logicalMessages.Any())
{
log.Warn("Received an empty message - ignoring.");
}
}

next();
Expand Down
8 changes: 1 addition & 7 deletions src/NServiceBus.Distributor.MSMQ/LicenseConfig.cs
Expand Up @@ -10,18 +10,13 @@ namespace NServiceBus.Distributor.MSMQ
/// </summary>
internal static class LicenseConfig
{
static LicenseConfig()
{
allowedWorkerNodes = LicenseManager.License.AllowedNumberOfWorkerNodes;
}

internal static bool LimitNumberOfWorkers(Address workerAddress)
{
if (WorkersList.Contains(workerAddress))
{
return false;
}

var allowedWorkerNodes = LicenseManager.License.AllowedNumberOfWorkerNodes;
if (WorkersList.Count < allowedWorkerNodes)
{
WorkersList.Add(workerAddress);
Expand All @@ -34,7 +29,6 @@ internal static bool LimitNumberOfWorkers(Address workerAddress)
}

static readonly ILog Logger = LogManager.GetLogger(typeof(LicenseConfig));
static readonly int allowedWorkerNodes;
static readonly ConcurrentBag<Address> WorkersList = new ConcurrentBag<Address>();
}
}

0 comments on commit 21092c7

Please sign in to comment.