mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
In order to properly free all memory allocated by the `Event` returned from connlib, we need to `.destroy()` it. For this to happen automatically, we can call the `.use` helper. Unfortunately, there are no compile-time warnings about this so we have to manually audit the generated code to check which objects needs closing after use. From what I can gather, the `Event` only needs to be closed because we hold a reference to the `DisconnectError` inside `Disconnected`. Because we exit after that anyway, I believe all memory is free'd regardless already.