Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OnTokenActivated event for token change notifications #2868

Closed
wants to merge 2 commits into from

Conversation

marcschier
Copy link
Contributor

Proposed changes

Add a new event OnTokenActivated to the ITransportChannel class to notify when a channel token is activated. Implemented this event in the HttpsTransportChannel class within the Opc.Ua.Bindings namespace. Introduced a protected internal OnTokenActivated event handler in the UaSCBinaryChannel.Symmetric class, invoked during token changes in the ActivateToken and DiscardTokens methods.

Related Issues

  • Fixes #

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply. You can also fill these out after creating the PR.

  • Bugfix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Test enhancement (non-breaking change to increase test coverage)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected, requires version increase of Nuget packages)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc.
  • I have signed the CLA.
  • I ran tests locally with my changes, all passed.
  • I fixed all failing tests in the CI pipelines.
  • I fixed all introduced issues with CodeQL and LGTM.
  • I have added tests that prove my fix is effective or that my feature works and increased code coverage.
  • I have added necessary documentation (if appropriate).
  • Any dependent changes have been merged and published in downstream modules.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

Added a new event `OnTokenActivated` to the `UaChannelBase` class in the `Opc.Ua` namespace to notify when a channel token is activated. Implemented this event in the `HttpsTransportChannel` class within the `Opc.Ua.Bindings` namespace. Introduced a protected internal `OnTokenActivated` event handler in the `UaSCBinaryChannel.Symmetric` class, invoked during token changes in the `ActivateToken` and `DiscardTokens` methods. Cleaned up the event handler in the `Dispose` method of the `UaSCBinaryClientChannel` class. Registered the event handler with the internal channel in the `UaSCBinaryTransportChannel` class. Added a new delegate `ChannelTokenActivatedEventHandler` in the `ITransportChannel` interface and updated the interface to include the `OnTokenActivated` event. Made minor formatting and comment adjustments for improved readability and consistency.
@marcschier marcschier requested a review from mregen November 29, 2024 10:16
Copy link

codecov bot commented Nov 29, 2024

Codecov Report

Attention: Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.

Project coverage is 55.31%. Comparing base (ce33d63) to head (2b376ce).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
Stack/Opc.Ua.Core/Stack/Client/UaChannelBase.cs 0.00% 2 Missing ⚠️
...k/Opc.Ua.Core/Stack/Https/HttpsTransportChannel.cs 0.00% 2 Missing ⚠️
...pc.Ua.Core/Stack/Tcp/UaSCBinaryTransportChannel.cs 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2868      +/-   ##
==========================================
- Coverage   55.70%   55.31%   -0.39%     
==========================================
  Files         352      352              
  Lines       67332    67343      +11     
  Branches    13806    13808       +2     
==========================================
- Hits        37506    37253     -253     
- Misses      25792    26006     +214     
- Partials     4034     4084      +50     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mregen mregen changed the base branch from master to develop/main374 November 29, 2024 11:02
@mregen mregen changed the base branch from develop/main374 to master November 29, 2024 11:02
@mregen
Copy link
Contributor

mregen commented Nov 30, 2024

please reopen against develop/main374

@marcschier marcschier closed this Dec 2, 2024
@marcschier marcschier deleted the mschier/channelcallback branch December 2, 2024 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants