-
Notifications
You must be signed in to change notification settings - Fork 1
Erweiterung der Tunnel-Client-Manager-Schnittstelle #5
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
Conversation
- `ITunnelClientManager` um neue Eigenschaften und Ereignisse erweitert. - Registrierung des `TunnelConnectionListenerFactory` als Singleton aktualisiert. - Konstruktor von `TunnelConnectionListener` angepasst, um Protokollierung zu unterstützen. - Verbesserte Handhabung von Tunnelverbindungen in `AcceptAsync`. - Aktualisierte Logik zur Verwaltung von Tokenquellen in `BindAsync`. - `TunnelConnectionListenerFactory` akzeptiert jetzt `ILoggerFactory`. - Hinzugefügte `IsEnabled`-Eigenschaft im `TunnelClientManager` zur Statusüberprüfung.
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 enhances the tunnel client management and listener components by adding new properties, integrating logging support, improving asynchronous handling, and updating dependency injection registrations.
- Added the IsEnabled property to ITunnelClientManager and its implementation.
- Updated TunnelConnectionListener and TunnelConnectionListenerFactory to support logging and better token management.
- Refactored dependency injection registration for TunnelConnectionListenerFactory.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/UFX.Relay/Tunnel/TunnelClientManager.cs | Added a new IsEnabled property delegating to _optionsStore.Current.isEnabled. |
| src/UFX.Relay/Tunnel/Listener/TunnelConnectionListenerFactory.cs | Injects ILoggerFactory and passes an ILogger to TunnelConnectionListener. |
| src/UFX.Relay/Tunnel/Listener/TunnelConnectionListener.cs | Updated constructor, improved async handling in AcceptAsync, BindAsync, and UnbindAsync with added logging. |
| src/UFX.Relay/Tunnel/Listener/ListenerBuilderExtensions.cs | Simplified DI registration for TunnelConnectionListenerFactory. |
| src/UFX.Relay/Abstractions/ITunnelClientManager.cs | Extended interface to expose the new IsEnabled property. |
Comments suppressed due to low confidence (1)
src/UFX.Relay/Tunnel/Listener/ListenerBuilderExtensions.cs:44
- Ensure that the dependency injection configuration includes a registration for ILoggerFactory, as TunnelConnectionListenerFactory now requires it in its constructor.
services.TryAddSingleton<TunnelConnectionListenerFactory>();
| endpoint.TunnelId = await tunnelIdProvider.GetTunnelIdAsync() | ||
| ?? throw new KeyNotFoundException("TunnelId not found, you need to configure a tunnel-id"); | ||
|
|
||
| _ = Task.Run(() => ReconnectTunnelAsync(unbindTokenSource.Token)); // fire-and-forget |
Copilot
AI
May 8, 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.
[nitpick] Consider capturing and monitoring the Task returned by Task.Run so that any exceptions from the fire-and-forget operation can be properly handled or logged.
| _ = Task.Run(() => ReconnectTunnelAsync(unbindTokenSource.Token)); // fire-and-forget | |
| _ = Task.Run(() => ReconnectTunnelAsync(unbindTokenSource.Token)) | |
| .ContinueWith(task => | |
| { | |
| if (task.Exception is not null) | |
| { | |
| logger.LogError(task.Exception, "An error occurred in ReconnectTunnelAsync."); | |
| } | |
| }, TaskContinuationOptions.OnlyOnFaulted); // Log exceptions if the task faults |
- Umbenennung von Variablen und Einführung von privaten Feldern in `TunnelConnectionListener.cs` zur Verbesserung der Lesbarkeit und Kapselung. - Hinzufügen der `TunnelClientManager`-Eigenschaft in `TunnelEndpoint.cs`, um den Zugriff auf Tunnel zu optimieren. - Neue Eigenschaften `DelayWhenDisabled` und `DelayWhenDisconnected` in `TunnelListenerOptions.cs` zur besseren Steuerung von Verzögerungen. - Anpassungen der Fehlerbehandlung in `TunnelClientManager.cs`, um die Robustheit und Protokollierung zu verbessern.
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 extends the Tunnel Client Manager interface and improves the handling and logging of tunnel connections. Key changes include:
- Addition of the IsEnabled property in ITunnelClientManager and its use in connection management.
- Refactoring of TunnelConnectionListener for improved connection state handling and logging.
- Updates to dependency injection registrations for TunnelConnectionListenerFactory.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/UFX.Relay/Tunnel/TunnelClientManager.cs | Added IsEnabled property and slight updates to connection error-state handling. |
| src/UFX.Relay/Tunnel/Listener/TunnelListenerOptions.cs | Introduced DelayWhenDisabled and DelayWhenDisconnected options with documentation. |
| src/UFX.Relay/Tunnel/Listener/TunnelEndpoint.cs | Modified Tunnel property to retrieve its value via TunnelClientManager and added TunnelClientManager property. |
| src/UFX.Relay/Tunnel/Listener/TunnelConnectionListenerFactory.cs | Updated constructor signature to include ILoggerFactory and changed how the listener is instantiated accordingly. |
| src/UFX.Relay/Tunnel/Listener/TunnelConnectionListener.cs | Refactored connection acceptance, binding, unbinding, and disposal logic with improved logging. |
| src/UFX.Relay/Tunnel/Listener/ListenerBuilderExtensions.cs | Simplified registration of TunnelConnectionListenerFactory in DI. |
| src/UFX.Relay/Abstractions/ITunnelClientManager.cs | Added the IsEnabled property to support status monitoring. |
Comments suppressed due to low confidence (1)
src/UFX.Relay/Tunnel/Listener/ListenerBuilderExtensions.cs:44
- Ensure that all required dependencies for TunnelConnectionListenerFactory (such as ILoggerFactory) are registered in the DI container.
services.TryAddSingleton<TunnelConnectionListenerFactory>();
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ITunnelClientManagerum neue Eigenschaften und Ereignisse erweitert.TunnelConnectionListenerFactoryals Singleton aktualisiert.TunnelConnectionListenerangepasst, um Protokollierung zu unterstützen.AcceptAsync.BindAsync.TunnelConnectionListenerFactoryakzeptiert jetztILoggerFactory.IsEnabled-Eigenschaft imTunnelClientManagerzur Statusüberprüfung.