Skip to content

Commit

Permalink
Merge branch 'master' into time-calculation-error-on-system-time-change
Browse files Browse the repository at this point in the history
  • Loading branch information
bhnaphade committed Apr 23, 2024
2 parents 59437eb + 60689c9 commit 484691e
Show file tree
Hide file tree
Showing 207 changed files with 2,337 additions and 1,132 deletions.
2 changes: 1 addition & 1 deletion .azurepipelines/testcc.yml
Expand Up @@ -54,7 +54,7 @@ jobs:
inputs:
command: test
projects: 'UA Core Library.sln'
# note: /p:CollectCoverage=true is only used to disable deterministc builds
# note: /p:CollectCoverage=true is only used to disable deterministic builds
arguments: '--no-restore ${{ variables.DotCliCommandline }} --configuration ${{ parameters.configuration }} /p:CollectCoverage=true --collect:"XPlat Code Coverage" --settings ./Tests/coverlet.runsettings.xml --results-directory $(Agent.TempDirectory)'
publishTestResults: false
- script: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/buildandtest.yml
Expand Up @@ -53,7 +53,7 @@ jobs:
run: dotnet build ${{ env.CSPROJECT }} --force --framework ${{ matrix.framework }} --configuration ${{ matrix.configuration }} /p:CustomTestTarget=${{ matrix.customtesttarget }}

- name: Test
# note: /p:CollectCoverage=true is only used to disable deterministc builds
# note: /p:CollectCoverage=true is only used to disable deterministic builds
run: dotnet test ${{ env.CSPROJECT }} --no-build --framework ${{ matrix.framework }} --logger trx --configuration ${{ matrix.configuration }} /p:CollectCoverage=true /p:CustomTestTarget=${{ matrix.customtesttarget }} --collect:"XPlat Code Coverage" --settings ./Tests/coverlet.runsettings.xml --results-directory ${{ env.TESTRESULTS }}

- name: Upload test results
Expand Down
2 changes: 1 addition & 1 deletion Applications/ConsoleReferenceClient/ClientSamples.cs
Expand Up @@ -571,7 +571,7 @@ public void SubscribeToDataChanges(ISession session, uint minLifeTime)
ClientBase.ValidateResponse(browseResultCollection, browseCollection);
ClientBase.ValidateDiagnosticInfos(diagnosticsInfoCollection, browseCollection);

// seperate unprocessed nodes for later
// separate unprocessed nodes for later
int ii = 0;
foreach (BrowseResult browseResult in browseResultCollection)
{
Expand Down
19 changes: 17 additions & 2 deletions Applications/ConsoleReferenceClient/Program.cs
Expand Up @@ -83,6 +83,8 @@ public static async Task Main(string[] args)
int timeout = Timeout.Infinite;
string logFile = null;
string reverseConnectUrlString = null;
bool leakChannels = false;
bool forever = false;

Mono.Options.OptionSet options = new Mono.Options.OptionSet {
usage,
Expand All @@ -104,6 +106,8 @@ public static async Task Main(string[] args)
{ "v|verbose", "Verbose output", v => { if (v != null) verbose = true; } },
{ "s|subscribe", "Subscribe", s => { if (s != null) subscribe = true; } },
{ "rc|reverseconnect=", "Connect using the reverse connect endpoint. (e.g. rc=opc.tcp://localhost:65300)", (string url) => reverseConnectUrlString = url},
{ "forever", "run inner connect/disconnect loop forever", f => { if (f != null) forever = true; } },
{ "leakchannels", "Leave a channel leak open when disconnecting a session.", l => { if (l != null) leakChannels = true; } },
};

ReverseConnectManager reverseConnectManager = null;
Expand Down Expand Up @@ -189,12 +193,23 @@ public static async Task Main(string[] args)
waitTime = timeout - (int)DateTime.UtcNow.Subtract(start).TotalMilliseconds;
if (waitTime <= 0)
{
if (!forever)
{
break;
}
else
{
waitTime = 0;
}
}

// create the UA Client object and connect to configured server.
if (forever)
{
start = DateTime.UtcNow;
}
}

// create the UA Client object and connect to configured server.
using (UAClient uaClient = new UAClient(application.ApplicationConfiguration, reverseConnectManager, output, ClientBase.ValidateResponse) {
AutoAccept = autoAccept,
SessionLifeTime = 60_000,
Expand Down Expand Up @@ -308,7 +323,7 @@ public static async Task Main(string[] args)

output.WriteLine("Client disconnected.");

uaClient.Disconnect();
uaClient.Disconnect(leakChannels);
}
else
{
Expand Down
10 changes: 8 additions & 2 deletions Applications/ConsoleReferenceClient/UAClient.cs
Expand Up @@ -230,7 +230,8 @@ public async Task<bool> ConnectAsync(string serverUrl, bool useSecurity = true,
/// <summary>
/// Disconnects the session.
/// </summary>
public void Disconnect()
/// <param name="leaveChannelOpen">Leaves the channel open.</param>
public void Disconnect(bool leaveChannelOpen = false)
{
try
{
Expand All @@ -245,7 +246,12 @@ public void Disconnect()
m_reconnectHandler = null;
}

m_session.Close();
m_session.Close(!leaveChannelOpen);
if (leaveChannelOpen)
{
// detach the channel, so it doesn't get closed when the session is disposed.
m_session.DetachChannel();
}
m_session.Dispose();
m_session = null;

Expand Down
Expand Up @@ -69,7 +69,7 @@
<MaxArrayLength>65535</MaxArrayLength>
<MaxMessageSize>4194304</MaxMessageSize>
<MaxBufferSize>65535</MaxBufferSize>
<ChannelLifetime>300000</ChannelLifetime>
<ChannelLifetime>30000</ChannelLifetime>
<SecurityTokenLifetime>3600000</SecurityTokenLifetime>
</TransportQuotas>
<ServerConfiguration>
Expand All @@ -90,9 +90,9 @@
-->
<!--
<AlternateBaseAddresses>
<ua:String>http://AlternateHostName/Quickstarts/ReferenceServer</ua:String>
<ua:String>http://10.10.103.150/Quickstarts/ReferenceServer</ua:String>
<ua:String>http://[2a01::626d]/Quickstarts/ReferenceServer</ua:String>
<ua:String>opc.tcp://AlternateHostName/Quickstarts/ReferenceServer</ua:String>
<ua:String>opc.tcp://10.10.103.150/Quickstarts/ReferenceServer</ua:String>
<ua:String>opc.tcp://[2a01::626d]/Quickstarts/ReferenceServer</ua:String>
</AlternateBaseAddresses>
-->
<SecurityPolicies>
Expand Down Expand Up @@ -163,6 +163,7 @@
<DiagnosticsEnabled>true</DiagnosticsEnabled>
<!-- Settings for CTT testing -->
<MaxSessionCount>75</MaxSessionCount>
<MaxChannelCount>1000</MaxChannelCount>
<MinSessionTimeout>10000</MinSessionTimeout>
<MaxSessionTimeout>3600000</MaxSessionTimeout>
<MaxBrowseContinuationPoints>10</MaxBrowseContinuationPoints>
Expand Down Expand Up @@ -229,6 +230,7 @@
<ua:String>http://opcfoundation.org/UA-Profile/Server/ReverseConnect</ua:String>
<ua:String>http://opcfoundation.org/UA-Profile/Server/ClientRedundancy</ua:String>
</ServerProfileArray>

<ShutdownDelay>5</ShutdownDelay>
<ServerCapabilities>
<ua:String>DA</ua:String>
Expand Down Expand Up @@ -259,17 +261,15 @@
<OperationLimits>
<MaxNodesPerRead>2500</MaxNodesPerRead>
<MaxNodesPerHistoryReadData>1000</MaxNodesPerHistoryReadData>
<MaxNodesPerHistoryReadEvents>1000</MaxNodesPerHistoryReadEvents>
<MaxNodesPerWrite>2500</MaxNodesPerWrite>
<MaxNodesPerHistoryUpdateData>1000</MaxNodesPerHistoryUpdateData>
<MaxNodesPerHistoryUpdateEvents>1000</MaxNodesPerHistoryUpdateEvents>
<MaxNodesPerMethodCall>2500</MaxNodesPerMethodCall>
<MaxNodesPerBrowse>2500</MaxNodesPerBrowse>
<MaxNodesPerRegisterNodes>2500</MaxNodesPerRegisterNodes>
<MaxNodesPerTranslateBrowsePathsToNodeIds>2500</MaxNodesPerTranslateBrowsePathsToNodeIds>
<MaxNodesPerNodeManagement>2500</MaxNodesPerNodeManagement>
<MaxMonitoredItemsPerCall>2500</MaxMonitoredItemsPerCall>
</OperationLimits>

<AuditingEnabled>true</AuditingEnabled>
</ServerConfiguration>

Expand Down
Expand Up @@ -192,7 +192,7 @@ private static void UpdateDisplayName(BaseInstanceState instance, string unitLab
}

/// <summary>
/// Loads a node set from a file or resource and addes them to the set of predefined nodes.
/// Loads a node set from a file or resource and adds them to the set of predefined nodes.
/// </summary>
protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
{
Expand Down
Expand Up @@ -34,7 +34,7 @@
namespace Boiler
{
/// <summary>
/// A object representing a generic controller.
/// An object representing a generic controller.
/// </summary>
public partial class GenericControllerState
{
Expand Down
Expand Up @@ -152,7 +152,7 @@ public override void CreateAddressSpace(IDictionary<NodeId, IList<IReference>> e
}

/// <summary>
/// Loads a node set from a file or resource and addes them to the set of predefined nodes.
/// Loads a node set from a file or resource and adds them to the set of predefined nodes.
/// </summary>
protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
{
Expand Down
Expand Up @@ -190,7 +190,7 @@ public void CreateBuffer(BuiltInType elementType, int noOfElements)
}

/// <summary>
/// Creates an object which can browser the tags in the buffer.
/// Creates an object which can browse the tags in the buffer.
/// </summary>
public override INodeBrowser CreateBrowser(
ISystemContext context,
Expand Down
Expand Up @@ -358,7 +358,7 @@ public virtual void CreateAddressSpace(IDictionary<NodeId, IList<IReference>> ex

#region CreateAddressSpace Support Functions
/// <summary>
/// Loads a node set from a file or resource and addes them to the set of predefined nodes.
/// Loads a node set from a file or resource and adds them to the set of predefined nodes.
/// </summary>
public virtual void LoadPredefinedNodes(
ISystemContext context,
Expand All @@ -381,15 +381,15 @@ public virtual void CreateAddressSpace(IDictionary<NodeId, IList<IReference>> ex
}

/// <summary>
/// Loads a node set from a file or resource and addes them to the set of predefined nodes.
/// Loads a node set from a file or resource and adds them to the set of predefined nodes.
/// </summary>
protected virtual NodeStateCollection LoadPredefinedNodes(ISystemContext context)
{
return new NodeStateCollection();
}

/// <summary>
/// Loads a node set from a file or resource and addes them to the set of predefined nodes.
/// Loads a node set from a file or resource and adds them to the set of predefined nodes.
/// </summary>
protected virtual void LoadPredefinedNodes(
ISystemContext context,
Expand Down Expand Up @@ -722,7 +722,7 @@ protected void AddTypesToTypeTree(NodeId typeId)
}

/// <summary>
/// Finds the specified and checks if it is of the expected type.
/// Finds the specified node and checks if it is of the expected type.
/// </summary>
/// <returns>Returns null if not found or not of the correct type.</returns>
public NodeState FindPredefinedNode(NodeId nodeId, Type expectedType)
Expand Down Expand Up @@ -1297,7 +1297,7 @@ public virtual void AddReferences(IDictionary<NodeId, IList<IReference>> referen
{
errors[ii] = StatusCodes.BadNodeIdUnknown;

// must validate node in a seperate operation.
// must validate node in a separate operation.
ReadWriteOperationState operation = new ReadWriteOperationState();

operation.Source = source;
Expand Down Expand Up @@ -1429,7 +1429,7 @@ protected virtual bool ValidateNode(ServerSystemContext context, NodeState node)
// check if the node is ready for reading.
if (source.ValidationRequired)
{
// must validate node in a seperate operation.
// must validate node in a separate operation.
errors[ii] = StatusCodes.BadNodeIdUnknown;
nodesToValidate.Add(operation);
continue;
Expand Down Expand Up @@ -1639,7 +1639,7 @@ protected virtual bool ValidateNode(ServerSystemContext context, NodeState node)
{
errors[ii] = StatusCodes.BadNodeIdUnknown;

// must validate node in a seperate operation.
// must validate node in a separate operation.
ReadWriteOperationState operation = new ReadWriteOperationState();

operation.Source = source;
Expand Down Expand Up @@ -1734,7 +1734,7 @@ protected virtual bool ValidateNode(ServerSystemContext context, NodeState node)
{
errors[ii] = StatusCodes.BadNodeIdUnknown;

// must validate node in a seperate operation.
// must validate node in a separate operation.
ReadWriteOperationState operation = new ReadWriteOperationState();

operation.Source = source;
Expand Down Expand Up @@ -1832,7 +1832,7 @@ protected virtual bool ValidateNode(ServerSystemContext context, NodeState node)
{
errors[ii] = StatusCodes.BadNodeIdUnknown;

// must validate node in a seperate operation.
// must validate node in a separate operation.
CallOperationState operation = new CallOperationState();

operation.Source = source;
Expand Down Expand Up @@ -2243,7 +2243,7 @@ private struct CallOperationState
{
errors[ii] = StatusCodes.BadNodeIdUnknown;

// must validate node in a seperate operation.
// must validate node in a separate operation.
ReadWriteOperationState operation = new ReadWriteOperationState();

operation.Source = source;
Expand Down
Expand Up @@ -234,7 +234,7 @@ public override void CreateAddressSpace(IDictionary<NodeId, IList<IReference>> e
}

/// <summary>
/// Loads a node set from a file or resource and addes them to the set of predefined nodes.
/// Loads a node set from a file or resource and adds them to the set of predefined nodes.
/// </summary>
protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
{
Expand Down
Expand Up @@ -830,7 +830,7 @@ private T[] GetRandomArray<T>(Func<T> methodForSingleObject)
}

/// <summary>
/// Return random vector;
/// Return random vector.
/// </summary>
public Vector GetRandomVector()
{
Expand Down

0 comments on commit 484691e

Please sign in to comment.