Skip to content
Draft
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9c7d1b3
Implement management Methods from INodeManager & INodeManager2 into I…
romanett Sep 14, 2025
f8aff1f
Use Async methods in MasterNodeManager
romanett Sep 14, 2025
5359998
Update ReferenceServerWithLimits
romanett Sep 14, 2025
6a32d33
fix test
romanett Sep 15, 2025
5199ea9
fix typo
romanett Sep 15, 2025
d125051
propagate MonitoredItem Id using Func<uint> getNextMonitoredItemId in…
romanett Sep 15, 2025
3ca5082
update SampleNodeManager
romanett Sep 15, 2025
58aa6a9
Update MemoryBufferNodeManager
romanett Sep 15, 2025
34bc4b2
Merge branch 'feat/AsyncReadyCreateMonitoredItems' into feat/AsyncNod…
romanett Sep 15, 2025
4432e45
Implement Async MI Management methods in MasterNodeManager
romanett Sep 15, 2025
6b8a32b
fix indentation
romanett Sep 17, 2025
006d3cb
Merge remote-tracking branch 'origin/master' into feat/asyncNodeManager
romanett Sep 17, 2025
6bfc37f
remove obsolete sync code
romanett Sep 17, 2025
f12b7d5
use Class MonitoredItem Id to propagate MonitoredItemIds
romanett Sep 18, 2025
0e4ec62
use lock
romanett Sep 18, 2025
0d7de2d
rename, make instance readonly
romanett Sep 18, 2025
ce782b6
rename to MonitoredItemIdFactory
romanett Sep 18, 2025
4ccb6a7
Add Concurrency test
romanett Sep 19, 2025
b24c278
merge
romanett Sep 19, 2025
d2d0db9
fix build
romanett Sep 19, 2025
6a3476c
expose sync nodeManager
romanett Sep 19, 2025
d077ebb
Merge branch 'master' into feat/asyncNodeManager
marcschier Sep 21, 2025
9ec1d43
merge
romanett Sep 21, 2025
22384c2
fix build, fix analyzer messages
romanett Sep 21, 2025
1822eb4
Allow to register IAsyncNodeMangers, Add SyncNodeManager Adapter.
romanett Sep 21, 2025
5f29b72
Implement adapter
romanett Sep 21, 2025
13556cd
Add RemoveNamespaceMananager(IASyncNodeManager)
romanett Sep 21, 2025
c33dfd1
Allow AsyncNodeManagers in ReferenceServer
romanett Sep 21, 2025
86c9d23
merge
romanett Sep 22, 2025
6ed7aae
Add documentation
romanett Sep 22, 2025
acf25a5
Create real sync GetManagerHandle implementation
romanett Sep 22, 2025
c9be3ea
merge
romanett Sep 22, 2025
f00199f
fix typo
romanett Sep 22, 2025
8618df4
fix adapter, fix typos
romanett Sep 22, 2025
a1c6c47
document async method call
romanett Sep 22, 2025
7383079
Merge remote-tracking branch 'origin/master' into feat/moreAsync
romanett Sep 23, 2025
ec721ad
ActivateSessionAsync CreateSessionAsync
romanett Sep 24, 2025
99c7050
Add StartAsync StopAsync to ServerBase
romanett Sep 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Libraries/Opc.Ua.Gds.Server.Common/GlobalDiscoverySampleServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,15 @@ protected override OperationContext ValidateRequest(
// check for a user name token.
if (securityToken is UserNameIdentityToken)
{
lock (Lock)
SemaphoreSlim.Wait();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have an abstraction here when we expose the lock, something like ILock, then we have the opportunity to change this later, and dont repeat what we have already run into with the ubiqu SyncLock, SyncObject etc. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you expose like an AsyncLock or just a thin wrapper around semaphoreslim?

try
{
m_contexts.Add(context.RequestId, new ImpersonationContext());
}
finally
{
SemaphoreSlim.Release();
}
}
}

Expand All @@ -186,7 +191,8 @@ protected override OperationContext ValidateRequest(
/// </summary>
protected override void OnRequestComplete(OperationContext context)
{
lock (Lock)
SemaphoreSlim.Wait();
try
{
if (m_contexts.TryGetValue(
context.RequestId,
Expand All @@ -195,6 +201,10 @@ protected override void OnRequestComplete(OperationContext context)
m_contexts.Remove(context.RequestId);
}
}
finally
{
SemaphoreSlim.Release();
}

base.OnRequestComplete(context);
}
Expand Down
15 changes: 15 additions & 0 deletions Libraries/Opc.Ua.Server/Server/IServerInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace Opc.Ua.Server
{
Expand Down Expand Up @@ -210,6 +212,19 @@ public interface IServerInternal : IAuditEventServer, IDisposable
/// <param name="deleteSubscriptions">if set to <c>true</c> subscriptions are to be deleted.</param>
void CloseSession(OperationContext context, NodeId sessionId, bool deleteSubscriptions);

/// <summary>
/// Closes the specified session.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="sessionId">The session identifier.</param>
/// <param name="deleteSubscriptions">if set to <c>true</c> subscriptions are to be deleted.</param>
/// <param name="cancellationToken">The cancellation token.</param>
ValueTask CloseSessionAsync(
OperationContext context,
NodeId sessionId,
bool deleteSubscriptions,
CancellationToken cancellationToken = default);

/// <summary>
/// Deletes the specified subscription.
/// </summary>
Expand Down
22 changes: 21 additions & 1 deletion Libraries/Opc.Ua.Server/Server/ServerInternalData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using Opc.Ua.Security.Certificates;

namespace Opc.Ua.Server
Expand Down Expand Up @@ -455,7 +457,25 @@ public void CloseSession(
NodeId sessionId,
bool deleteSubscriptions)
{
NodeManager.SessionClosingAsync(context, sessionId, deleteSubscriptions).AsTask().GetAwaiter().GetResult();
CloseSessionAsync(context, sessionId, deleteSubscriptions)
.AsTask().GetAwaiter().GetResult();
}

/// <summary>
/// Closes the specified session.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="sessionId">The session identifier.</param>
/// <param name="deleteSubscriptions">if set to <c>true</c> subscriptions are to be deleted.</param>
/// <param name="cancellationToken">The cancellationToken</param>
public async ValueTask CloseSessionAsync(
OperationContext context,
NodeId sessionId,
bool deleteSubscriptions,
CancellationToken cancellationToken = default)
{
await NodeManager.SessionClosingAsync(context, sessionId, deleteSubscriptions, cancellationToken)
.ConfigureAwait(false);
SubscriptionManager.SessionClosing(context, sessionId, deleteSubscriptions);
SessionManager.CloseSession(sessionId);
}
Expand Down
Loading
Loading