Skip to content

refactor(conn): modular connector component#1100

Merged
0x676e67 merged 3 commits intomainfrom
rt
Mar 21, 2026
Merged

refactor(conn): modular connector component#1100
0x676e67 merged 3 commits intomainfrom
rt

Conversation

@0x676e67
Copy link
Copy Markdown
Owner

@0x676e67 0x676e67 commented Mar 21, 2026

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 connection handling components, primarily by introducing a modular TcpConnector trait. This change enhances the system's flexibility by abstracting the underlying TCP stream implementation, making it easier to integrate different network backends or custom connection behaviors. It also centralizes TCP and TLS configuration options, leading to a more organized and maintainable codebase for managing network connections.

Highlights

  • Modular TCP Connector: Introduced a new TcpConnector trait and a TokioTcpConnector implementation, allowing for greater flexibility and extensibility in handling TCP connections. This abstracts the underlying TCP stream implementation.
  • Refactored Connection Structs: The core Conn and TlsConn structs, along with their AsyncRead, AsyncWrite, and Connection implementations, have been moved to src/client/conn.rs for better organization and to centralize connection-related logic.
  • Unified TCP Options Management: Extracted and consolidated TCP-specific configuration options (like keepalive, buffer sizes, and local address binding) into new TcpOptions and SocketBindOptions structs within src/client/conn/tcp.rs. The HttpConnector now uses these standardized options.
  • Standardized Timer Usage: The ArcTimer wrapper has been removed, and the Time enum now directly holds Arc<dyn Timer + Send + Sync>, simplifying timer management and ensuring consistent behavior across different client components like HTTP/2 and connection pooling.
  • Improved TLS Connector Encapsulation: The HttpsConnector has been refactored to directly embed a TlsConnector instance, removing an intermediate Inner struct and streamlining the TLS handshake process.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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.

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
Copy Markdown
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 introduces a significant and well-executed refactoring of the connection handling logic, making the connector component more modular. The introduction of the TcpConnector trait and the new tcp module are great steps towards better separation of concerns. The simplification of the Timer abstraction is also a welcome improvement. I've identified a couple of areas where the code can be further improved by reducing duplication and simplifying an API, but overall, this is a solid enhancement to the codebase.

@0x676e67 0x676e67 marked this pull request as ready for review March 21, 2026 09:30
@0x676e67 0x676e67 merged commit 6cf1279 into main Mar 21, 2026
23 checks passed
@0x676e67 0x676e67 deleted the rt branch March 21, 2026 09:32
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.

1 participant