Skip to content

Conversation

@rgerhards
Copy link
Member

Expose open/close/open-failed callbacks for server sessions.
Document callback semantics in librelp headers.
Emit close callbacks on engine teardown.
Extend test receiver plus add session-callback test harness.

@rgerhards rgerhards self-assigned this Jan 4, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @rgerhards, 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 enhances the RELP engine's extensibility by exposing new API callbacks for server session lifecycle events. Developers can now register functions to be notified when a RELP session successfully opens, fails to open, or closes for any reason. This provides crucial hooks for monitoring, resource management, and custom logic tied to the state of individual RELP connections, improving the overall observability and integration capabilities of the RELP library.

Highlights

  • New Session Lifecycle Callbacks: Introduced onSessOpen, onSessClose, and onSessOpenFail callbacks to the RELP engine API, allowing external code to react to server session lifecycle events.
  • Comprehensive Documentation: Added detailed documentation for the new session callbacks in librelp.h, outlining their signatures, invocation conditions, and parameter usage.
  • Engine Teardown Integration: Ensured that onSessClose callbacks are properly emitted for all active sessions when the RELP engine is destructed.
  • Enhanced Testing: Extended the test receiver with new options to log session callback events and added a dedicated test harness (session-callbacks.sh) to verify the correct behavior of all new callbacks, including a script to simulate failed session opens.
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.

@rgerhards
Copy link
Member Author

/gemini review

Copy link

@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 session lifecycle callbacks (open, close, and open-fail) to the RELP engine, enhancing its extensibility and observability. The changes include adding callback function pointers to the relpEngine_s structure, defining corresponding setter functions in librelp.h and relp.c, and integrating the callback invocations at the appropriate points in the session management logic. Notably, the relpEngineDelSess function has been updated to accept a reason parameter, ensuring that session close callbacks provide context for termination. Comprehensive test cases have been added, including a new Python script to simulate an invalid open handshake and a shell script to orchestrate the testing of all new callbacks. The documentation for the new API functions is clear and detailed. Overall, the implementation is robust and well-tested, providing valuable new functionality without introducing any apparent issues.

Copy link

@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 session lifecycle callbacks (onSessOpen, onSessClose, onSessOpenFail), allowing applications to be notified of session state changes. The changes are well-implemented, with clear documentation for the new API in librelp.h and corresponding logic in copen.c and relp.c. The refactoring to use relpEngineDelSess during engine destruction is a good improvement for consistency and ensures callbacks are fired. The accompanying tests in tests/session-callbacks.sh and tests/invalid-open.py are comprehensive and cover both success and failure scenarios. I've only found a couple of minor indentation issues in src/relp.c which I've commented on. Overall, this is a great addition to the library.

Expose open/close/open-failed callbacks for server sessions.
Document callback semantics in librelp headers.
Emit close callbacks on engine teardown.
Extend test receiver plus add session-callback test harness.
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