mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-06-21 16:59:30 +00:00
The reuse branch in createFFIContext only fires for a parked slot, and a slot is only parked by releaseFFIContext. The generated destructor was still calling destroyFFIContext (full teardown, marks the slot uninitialised), so the reuse path never triggered and the fd-leak fix was inert in the generated API. Switch ffiDtor to releaseFFIContext so the worker and its fds survive the destroy and get reused on the next create. This is safe because the framework handles one request at a time: by the time the destructor runs the worker is idle, not mid-request, so parking cannot race a handler. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>