Skip to content

Misc Cleanups#33

Merged
kmesh-bot merged 1 commit intokmesh-net:mainfrom
hzxuzhonghu:cleanup
Aug 29, 2025
Merged

Misc Cleanups#33
kmesh-bot merged 1 commit intokmesh-net:mainfrom
hzxuzhonghu:cleanup

Conversation

@hzxuzhonghu
Copy link
Member

This patch does some cleanups

  1. refactor HttpChannelBuilder, and abstract several functions.
  2. remove private TokioExecutor implement, and use that from hyper

@hzxuzhonghu hzxuzhonghu requested review from Copilot and dawid-nowak and removed request for dawid-nowak August 15, 2025 08:06
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @hzxuzhonghu, 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 focuses on internal code cleanups and refactoring within the orion-lib crate. Key changes include abstracting functionality in HttpChannelBuilder for better maintainability and removing a custom TokioExecutor implementation in favor of the one provided by hyper_util, streamlining dependency usage.

Highlights

  • Refactor HttpChannelBuilder: The HttpChannelBuilder struct has been enhanced with a Default implementation, and its build method has been refactored into two new private helper methods: configure_hyper_client and configure_http2_if_needed. This improves modularity and readability by encapsulating client configuration logic.
  • Consolidate TokioExecutor usage: The custom TokioExecutor previously defined in orion-lib/src/utils.rs has been removed. All instances now directly utilize the TokioExecutor provided by the hyper_util crate, simplifying the project's runtime executor management and reducing redundant code.
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

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 performs cleanup operations by refactoring the HttpChannelBuilder class and removing a custom TokioExecutor implementation in favor of using the one provided by hyper. The changes improve code organization and eliminate duplicate functionality.

  • Refactored HttpChannelBuilder to use the Default trait and extracted HTTP client configuration into separate methods
  • Removed custom TokioExecutor implementation and switched to using hyper_util::rt::TokioExecutor
  • Consolidated import statements and improved code structure

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
orion-lib/src/utils.rs Removed entire file containing custom TokioExecutor implementation
orion-lib/src/transport/http_channel.rs Refactored HttpChannelBuilder with Default trait, extracted configuration methods, and switched to hyper's TokioExecutor
orion-lib/src/listeners/filterchain.rs Updated import and usage of TokioExecutor from hyper_util
orion-lib/src/lib.rs Removed utils module reference

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

} else {
let server_name = ServerName::try_from(authority.host().to_owned())?;
debug!("Server name is not configured in boostrap.. using endpoint authority {:?}", server_name);
debug!("Server name is not configured in bootstrap.. using endpoint authority {:?}", server_name);
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

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

Fixed typo: 'boostrap' should be 'bootstrap'

Suggested change
debug!("Server name is not configured in bootstrap.. using endpoint authority {:?}", server_name);
debug!("Server name is not configured.. using endpoint authority {:?}", server_name);

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 performs some useful cleanups. It refactors HttpChannelBuilder by abstracting several functions, which improves code structure and readability. It also removes a private TokioExecutor implementation in favor of the one from hyper-util, which is a good move towards using standard library components.

I have found one significant issue regarding a misconfiguration of an HTTP/2 parameter where a fixme comment was removed but the underlying problem persists. Please see my detailed comment.

Comment on lines +240 to +264
if let Some(max) = http2_options.max_concurrent_streams() {
client_builder.http2_max_concurrent_reset_streams(max);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The configuration option http2_options.max_concurrent_streams() is being used to set http2_max_concurrent_reset_streams. These are two distinct HTTP/2 settings. max_concurrent_streams controls the maximum number of concurrent streams, while max_concurrent_reset_streams limits how many streams can be reset by the client, as a denial-of-service protection.

Using the value for one to configure the other is a bug and will lead to unexpected behavior. The fixme comment that pointed this out was removed in this refactoring, but the issue remains.

To fix this, the field in Http2ProtocolOptions should be renamed to max_concurrent_reset_streams to accurately reflect what is being configured. Since that file is not part of this PR, you should at least restore the //fixme comment to track this issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

ignore

@hzxuzhonghu hzxuzhonghu force-pushed the cleanup branch 3 times, most recently from faa9609 to d136835 Compare August 29, 2025 10:13
Signed-off-by: Zhonghu Xu <xuzhonghu@huawei.com>
@dawid-nowak
Copy link
Member

/lgtm

@dawid-nowak
Copy link
Member

/approved

@kmesh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dawid-nowak

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kmesh-bot kmesh-bot merged commit 73fcb1b into kmesh-net:main Aug 29, 2025
4 checks passed
@hzxuzhonghu hzxuzhonghu deleted the cleanup branch August 30, 2025 01:02
Eeshu-Yadav pushed a commit to Eeshu-Yadav/orion that referenced this pull request Aug 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants