Skip to content

Commit

Permalink
Compliance fixes for OperationLimits and SetTriggering (#1469)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlinMoldovean committed Jul 26, 2021
1 parent ad0a5af commit b5421ea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@
-->
<OperationLimits>
<MaxNodesPerRead>1000</MaxNodesPerRead>
<MaxNodesPerBrowse>250</MaxNodesPerBrowse>
<MaxNodesPerWrite>1000</MaxNodesPerWrite>
<MaxNodesPerMethodCall>250</MaxNodesPerMethodCall>
<MaxNodesPerBrowse>2500</MaxNodesPerBrowse>
<MaxNodesPerTranslateBrowsePathsToNodeIds>1000</MaxNodesPerTranslateBrowsePathsToNodeIds>
<MaxMonitoredItemsPerCall>1000</MaxMonitoredItemsPerCall>
</OperationLimits>
</ServerConfiguration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@
<OperationLimits>
<MaxNodesPerRead>1000</MaxNodesPerRead>
<MaxNodesPerWrite>1000</MaxNodesPerWrite>
<MaxNodesPerBrowse>2500</MaxNodesPerBrowse>
<MaxMonitoredItemsPerCall>500</MaxMonitoredItemsPerCall>
<MaxNodesPerMethodCall>250</MaxNodesPerMethodCall>
<MaxNodesPerBrowse>2500</MaxNodesPerBrowse>
<MaxNodesPerTranslateBrowsePathsToNodeIds>1000</MaxNodesPerTranslateBrowsePathsToNodeIds>
<MaxMonitoredItemsPerCall>1000</MaxMonitoredItemsPerCall>
</OperationLimits>
</ServerConfiguration>

Expand Down
12 changes: 9 additions & 3 deletions Libraries/Opc.Ua.Server/Server/StandardServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1747,9 +1747,15 @@ public virtual void CompletePublish(IEndpointIncomingRequest request)

try
{
ValidateOperationLimits(linksToAdd, OperationLimits.MaxMonitoredItemsPerCall);
ValidateOperationLimits(linksToRemove, OperationLimits.MaxMonitoredItemsPerCall);
ValidateOperationLimits(linksToAdd.Count + linksToRemove.Count, OperationLimits.MaxMonitoredItemsPerCall);
if ((linksToAdd == null || linksToAdd.Count == 0) && (linksToRemove == null || linksToRemove.Count == 0))
{
throw new ServiceResultException(StatusCodes.BadNothingToDo);
}

int monitoredItemsCount = 0;
monitoredItemsCount += (linksToAdd?.Count) ?? 0;
monitoredItemsCount += (linksToRemove?.Count) ?? 0;
ValidateOperationLimits(monitoredItemsCount, OperationLimits.MaxMonitoredItemsPerCall);

ServerInternal.SubscriptionManager.SetTriggering(
context,
Expand Down

0 comments on commit b5421ea

Please sign in to comment.