mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
This patch series refactors how we handle allocations in the relay to make it easier to forward a failure to the `Server`. Each allocation runs in a separate task (to allow for parallelization). If the allocation fails, this channel is automatically closed. Previously, this would erroneously trigger a `debug_assert!`. Now, we invoke a callback on `Server` to allow it to clean up its internal resources for the allocation. At the same time, we simplify the buffering around data that is destined for a certain allocation. Instead of having an additional buffer in the event-loop, we increase the channel size to 10. Any exceeding items will be dropped to avoid memory growth. This means that the `Server` is never blocked on a slow allocation. Given that we are running on top of an unreliable protocol anyway, I'd say this is fine.