-
Notifications
You must be signed in to change notification settings - Fork 1k
[Server] Implement async transportlistener callback #3184
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
[Server] Implement async transportlistener callback #3184
Conversation
There was a problem hiding this 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/EndProcessRequestpattern withProcessRequestAsyncreturningTask<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.
| using CancellationTokenSource timeoutHintCts = timeoutHint > 0 ? | ||
| new CancellationTokenSource(timeoutHint) | ||
| : new CancellationTokenSource(); |
Copilot
AI
Sep 3, 2025
There was a problem hiding this comment.
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.
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
Proposed changes
Get rid of Begin/End async callback in ITransportlistenerCallback & IEndpointBase and instead use TAP async pattern.
Related Issues
Types of changes
Checklist
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...