-
Notifications
You must be signed in to change notification settings - Fork 24
TcpChannelTask Refactoring #162
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
Summary of ChangesHello @nslee333, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the TCP client channel implementation. The primary objective is to enhance the flexibility and maintainability of the client creation process by introducing a Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a ClientOptions builder for configuring the TCP client, which is a great step towards a more extensible and clear API. The refactoring within TcpChannelTask also improves code structure. My review focuses on a few areas to enhance consistency and clarity: renaming a new function for better descriptiveness, addressing an unused field which might indicate incomplete work, and completing the ClientOptions refactoring for the TLS client path to match the plain TCP implementation.
| connect_retry, | ||
| decode, | ||
| listener, | ||
| ConnectionLoggingStrategy::All, | ||
| ) |
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.
The refactoring to use ClientOptions has been applied to the plain TCP client, but not consistently to the TLS client. In create_tls_channel, ConnectionLoggingStrategy::All is hardcoded, and other options like max_queued_requests and decode are still passed as separate arguments.
For API consistency, the TLS client creation functions (spawn_tls_client_task in client/mod.rs and create_tls_channel here) should be updated to accept ClientOptions. This would allow users to configure all client options for TLS connections, just as they can for plain TCP.
| /// * `client_options` - A builder that contains various client options. | ||
| /// | ||
| /// `WARNING`: This function must be called from with the context of the Tokio runtime or it will panic. | ||
| pub fn spawn_tcp_client_task_2( |
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.
The function name spawn_tcp_client_task_2 is not idiomatic. A more descriptive name like spawn_tcp_client_task_with_options would better reflect its purpose. Consider also deprecating the older spawn_tcp_client_task function to guide users towards the new, more flexible API.
| pub fn spawn_tcp_client_task_2( | |
| pub fn spawn_tcp_client_task_with_options( |
| connection_handler: TcpTaskConnectionHandler, | ||
| client_loop: ClientLoop, | ||
| listener: Box<dyn Listener<ClientState>>, | ||
| _logging_strategy: ConnectionLoggingStrategy, |
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.
The field _logging_strategy is added to TcpChannelTask and initialized, but it's never used. The _ prefix indicates this is intentional to avoid compiler warnings, but it's unclear why an unused field is being added.
If this is for future use, please add a // TODO comment explaining its purpose. If it's not intended to be used, it should be removed. If the intention is to control logging, it should be used to conditionally enable/disable logging statements, for example in failed_tcp_connection and failed_tcp_stream_connection.
|
closed in favor of #163 |
No description provided.