Skip to content

Migrate to new callbacks#2037

Merged
tatsuhiro-t merged 1 commit intomainfrom
migrate-new-cbs
Mar 1, 2026
Merged

Migrate to new callbacks#2037
tatsuhiro-t merged 1 commit intomainfrom
migrate-new-cbs

Conversation

@tatsuhiro-t
Copy link
Copy Markdown
Member

Migrate to new callbacks that use ngtcp2_stateless_reset_token.

Migrate to new callbacks that use ngtcp2_stateless_reset_token.
@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 modernizes the callback infrastructure for handling connection IDs and stateless reset tokens within the ngtcp2 library. It involves a significant update to the callback interface, moving to a new structured token type and a dedicated callback field. These changes are propagated throughout the examples, simulation, fuzzing, and testing components to ensure consistency and proper integration with the updated API.

Highlights

  • Callback Signature Update: The get_new_connection_id callback signature has been updated to use ngtcp2_stateless_reset_token *token instead of uint8_t *token, providing a more structured way to handle stateless reset tokens.
  • Migration to get_new_connection_id2: The codebase has transitioned from using the get_new_connection_id callback field to a new field named get_new_connection_id2 within the ngtcp2_callbacks structure, reflecting the updated callback interface.
  • Examples and Simulation Updates: All example client/server implementations and the simulation environment have been modified to adopt the new callback signature and register their respective functions under get_new_connection_id2.
  • Fuzzing and Test Suite Alignment: The fuzzing targets and the connection test suite have been updated to align with the new callback mechanisms, including the introduction of new fuzzing callbacks for recv_stateless_reset2, get_new_connection_id2, and dcid_status2.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • examples/client.cc
    • Updated the get_new_connection_id function signature to accept ngtcp2_stateless_reset_token *token.
    • Removed the old get_new_connection_id callback registration.
    • Added registration for the new get_new_connection_id2 callback.
  • examples/gtlssimpleclient.c
    • Updated the get_new_connection_id_cb function signature to accept ngtcp2_stateless_reset_token *token.
    • Modified the gnutls_rnd call to correctly use token->data.
    • Removed the old get_new_connection_id callback registration.
    • Added registration for the new get_new_connection_id2 callback.
  • examples/h09client.cc
    • Updated the get_new_connection_id function signature to accept ngtcp2_stateless_reset_token *token.
    • Removed the old get_new_connection_id callback registration.
    • Added registration for the new get_new_connection_id2 callback.
  • examples/h09server.cc
    • Updated the get_new_connection_id function signature to accept ngtcp2_stateless_reset_token *token.
    • Removed the old get_new_connection_id callback registration.
    • Added registration for the new get_new_connection_id2 callback.
  • examples/server.cc
    • Updated the get_new_connection_id function signature to accept ngtcp2_stateless_reset_token *token.
    • Removed the old get_new_connection_id callback registration.
    • Added registration for the new get_new_connection_id2 callback.
  • examples/sim.cc
    • Updated the get_new_connection_id function signature to accept ngtcp2_stateless_reset_token *token.
    • Removed the old get_new_connection_id callback registration.
    • Added registration for the new get_new_connection_id2 callback.
  • fuzz/read_write_handshake_pkt.cc
    • Removed the deprecated get_new_connection_id function.
    • Introduced a new get_new_connection_id2 function that uses the updated ngtcp2_stateless_reset_token type.
    • Updated the callback registration to use get_new_connection_id2.
  • fuzz/read_write_pkt.cc
    • Added a new recv_stateless_reset2 callback for fuzzing purposes.
    • Added a new get_new_connection_id2 callback for fuzzing purposes.
    • Added a new dcid_status2 callback for fuzzing purposes.
    • Registered the new callbacks in the setup_conn function.
    • Implemented conditional nulling of the new callbacks based on fuzzed data.
  • tests/ngtcp2_conn_test.c
    • Updated the get_new_connection_id function to initialize ngtcp2_cid and ngtcp2_stateless_reset_token using struct initializers.
    • Removed the old get_new_connection_id callback registration from server_default_callbacks and client_default_callbacks.
    • Added registration for the new get_new_connection_id2 callback in server_default_callbacks and client_default_callbacks.
Activity
  • No specific activity has been recorded for this pull request yet.
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.

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
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 migrates several callback functions to use the new ngtcp2_stateless_reset_token struct instead of a raw uint8_t* pointer for stateless reset tokens. The changes are applied consistently across various example clients, servers, fuzzing targets, and tests. The implementation has been updated to access the token data via token->data and in some test/fuzz files, the code has been modernized to use struct initializers, which improves clarity and safety. The migration appears to be correct and complete.

@tatsuhiro-t tatsuhiro-t merged commit d3dae55 into main Mar 1, 2026
73 checks passed
@tatsuhiro-t tatsuhiro-t deleted the migrate-new-cbs branch March 1, 2026 03:13
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.

1 participant