Closed Alex6092 closed 7 years ago
A better fix would be to check the subscriptions count and reject the request before creating the subscription. Something like this:
public virtual void CreateSubscription(
OperationContext context,
double requestedPublishingInterval,
uint requestedLifetimeCount,
uint requestedMaxKeepAliveCount,
uint maxNotificationsPerPublish,
bool publishingEnabled,
byte priority,
out uint subscriptionId,
out double revisedPublishingInterval,
out uint revisedLifetimeCount,
out uint revisedMaxKeepAliveCount)
{
lock (m_lock)
{
if (m_subscriptions.Count >= m_maxSubscriptionCount)
{
throw new ServiceResultException(StatusCodes.BadTooManySubscriptions);
}
}
subscriptionId = 0;
revisedPublishingInterval = 0;
In case of subscription number overflow, diagnostics information are updated with the subscription which cannot be created.
To fix it, we propose the following modification of file SampleApplications/SampleLibraries/Server/SubscriptionManager.cs, around line 574, function CreateSubscription :