Skip to content

Commit

Permalink
Add MaxSessionTimeout (#361)
Browse files Browse the repository at this point in the history
* Update nuget packages

* Update version

* Add MaxSessionTimeout
  • Loading branch information
luiscantero authored Jun 7, 2024
1 parent 75ac67b commit 6152104
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 10 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ Options:
--msec, --maxsessioncount=VALUE
maximum number of parallel sessions.
Default: 100
--mset, --maxsessiontimeout=VALUE
maximum time that a session can remain open
without communication in milliseconds.
Default: 3600000
--msuc, --maxsubscriptioncount=VALUE
maximum number of subscriptions.
Default: 100
Expand Down
3 changes: 2 additions & 1 deletion src/Configuration/CliOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public static (PlcSimulation PlcSimulationInstance, List<string> ExtraArgs) Init

{ "to|trustowncert", $"the own certificate is put into the trusted certificate store automatically.\nDefault: {config.OpcUa.TrustMyself}", (s) => config.OpcUa.TrustMyself = s != null },

{ "msec|maxsessioncount=", $"maximum number of parallel sessions.\nDefault: {config.OpcUa.MaxSessionCount}", (int i) => config.OpcUa.MaxSessionCount = i },
{ "msec|maxsessioncount=", $"maximum number of parallel sessions.\nDefault: {config.OpcUa.MaxSessionCount}", (int i) => config.OpcUa.MaxSessionCount = i },
{ "mset|maxsessiontimeout=", $"maximum time that a session can remain open without communication in milliseconds.\nDefault: {config.OpcUa.MaxSessionTimeout}", (int i) => config.OpcUa.MaxSessionTimeout = i },

{ "msuc|maxsubscriptioncount=", $"maximum number of subscriptions.\nDefault: {config.OpcUa.MaxSubscriptionCount}", (int i) => config.OpcUa.MaxSubscriptionCount = i },
{ "mqrc|maxqueuedrequestcount=", $"maximum number of requests that will be queued waiting for a thread.\nDefault: {config.OpcUa.MaxQueuedRequestCount}", (int i) => config.OpcUa.MaxQueuedRequestCount = i },
Expand Down
2 changes: 2 additions & 0 deletions src/Configuration/OpcApplicationConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public string Hostname

public int MaxSessionCount { get; set; } = 100;

public int MaxSessionTimeout { get; set; } = 3_600_000; // 1 h.

public int MaxSubscriptionCount { get; set; } = 100;

public int MaxQueuedRequestCount { get; set; } = 2_000;
Expand Down
1 change: 1 addition & 0 deletions src/Configuration/OpcUaAppConfigFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public async Task<ApplicationConfiguration> ConfigureAsync()
.SetAuditingEnabled(true)
// Set the server capabilities.
.SetMaxSessionCount(_config.OpcUa.MaxSessionCount)
.SetMaxSessionTimeout(_config.OpcUa.MaxSessionTimeout)
.SetMaxSubscriptionCount(_config.OpcUa.MaxSubscriptionCount)
.SetMaxQueuedRequestCount(_config.OpcUa.MaxQueuedRequestCount)
.SetOperationLimits(operationLimits)
Expand Down
8 changes: 4 additions & 4 deletions src/opc-plc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.8.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.8.1" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="3.0.0" />
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageReference Update="Nerdbank.GitVersioning" Version="3.6.133" />
<PackageReference Update="Nerdbank.GitVersioning" Version="3.6.139" />
</ItemGroup>

<Choose>
<When Condition="'$(Configuration)'=='Release'">
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.50-preview" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.5.374.50-preview" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.54" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.5.374.54" NoWarn="NU5104" />
</ItemGroup>
</When>
<Otherwise>
Expand Down
8 changes: 4 additions & 4 deletions tests/opc-plc-tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
</ItemGroup>

<Choose>
<When Condition="'$(Configuration)'=='Release'">
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.5.374.50-preview" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.50-preview" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes" Version="1.5.374.50-preview" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.5.374.54" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.54" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes" Version="1.5.374.54" NoWarn="NU5104" />
</ItemGroup>
</When>
<Otherwise>
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "2.12.11",
"version": "2.12.12",
"versionHeightOffset": -1,
"publicReleaseRefSpec": [
"^refs/heads/main$",
Expand Down

0 comments on commit 6152104

Please sign in to comment.