Skip to content

Expose close callback in Python ClientWrapper - #2072

Open
iibaranov-IG wants to merge 1 commit into
OpenLightingProject:masterfrom
iibaranov-IG:fix/2031-expose-close-callback
Open

iibaranov-IG wants to merge 1 commit into
OpenLightingProject:masterfrom
iibaranov-IG:fix/2031-expose-close-callback

Conversation

@iibaranov-IG

Copy link
Copy Markdown

Fixes #2031.

ClientWrapper now accepts a close_callback and forwards it to OlaClient, allowing applications to stop or reconnect cleanly when olad restarts. Socket teardown is also idempotent: the socket reference is cleared before shutdown and the callback is consumed after its first invocation, so destructor or repeated close paths cannot call it twice.

Validation:

  • new regression test failed before the implementation with unexpected keyword argument 'close_callback'
  • ClientWrapperTest.testCloseCallback and all five OlaClientTest tests pass with generated protobuf bindings
  • flake8 passes for all three changed Python files

Pass ClientWrapper close callbacks through to OlaClient so applications can recover when olad restarts. Make socket closure idempotent so the callback runs once.

Assisted-by: Codex:GPT-6
Signed-off-by: Igor Baranov <iibaranov@gmail.com>
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.

Python API doesn't expose OlaClient's close_callback

1 participant