Skip to content

Conversation

@romanett
Copy link
Contributor

@romanett romanett commented Sep 3, 2025

Proposed changes

Get rid of Begin/End async callback in ITransportlistenerCallback & IEndpointBase and instead use TAP async pattern.

Related Issues

  • Fixes #

Types of changes

  • 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

  • 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...

@romanett romanett requested a review from Copilot September 3, 2025 15:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the OPC UA transport layer to replace the Begin/End async callback pattern with the modern Task-based Async Pattern (TAP). The change eliminates the need for paired Begin/End methods and simplifies async operations by returning Task objects directly.

  • Replaces BeginProcessRequest/EndProcessRequest pattern with ProcessRequestAsync returning Task<IServiceResponse>
  • Updates transport listeners to use async/await pattern instead of callback-based processing
  • Removes synchronous processing path and large sections of deprecated thread scheduler code

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ITransportListenerCallback.cs Updates interface to use async pattern with cancellation token support
TcpTransportListener.cs Refactors request handling to use async/await and removes callback completion method
ServerBase.cs Removes deprecated thread scheduler code and updates async request processing
IServerBase.cs Updates interface signature to include cancellation token
IEndpointBase.cs Replaces Begin/End pattern with async method returning Task
EndpointBase.cs Implements new async pattern and adds EndpointIncomingRequest class
HttpsTransportListener.cs Updates to use new async callback pattern

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 1100 to 1102
using CancellationTokenSource timeoutHintCts = timeoutHint > 0 ?
new CancellationTokenSource(timeoutHint)
: new CancellationTokenSource();
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

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

Creating a CancellationTokenSource when timeoutHint is 0 or negative is unnecessary. Consider only creating it when timeoutHint > 0 and using CancellationToken.None otherwise.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Sep 3, 2025

Codecov Report

❌ Patch coverage is 66.29213% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.58%. Comparing base (520351c) to head (c79f6e0).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
Stack/Opc.Ua.Core/Stack/Server/EndpointBase.cs 62.90% 19 Missing and 4 partials ⚠️
...tack/Opc.Ua.Core/Stack/Tcp/TcpTransportListener.cs 72.22% 3 Missing and 2 partials ⚠️
Stack/Opc.Ua.Core/Stack/Server/ServerBase.cs 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3184      +/-   ##
==========================================
- Coverage   58.03%   57.58%   -0.46%     
==========================================
  Files         356      354       -2     
  Lines       78102    78120      +18     
  Branches    13817    13823       +6     
==========================================
- Hits        45330    44984     -346     
- Misses      28599    28907     +308     
- Partials     4173     4229      +56     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@romanett romanett added this to the 1.5.378 Async Server Update 2 milestone Sep 4, 2025
@marcschier marcschier merged commit 0f031aa into OPCFoundation:master Sep 11, 2025
76 of 77 checks passed
@romanett romanett deleted the feat/asyncTransportListeners branch September 13, 2025 12:13
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