mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
Should be easier to review commit by commit. The gist of this commit is: * `onAddRoute` on Android now takes an address+prefix as to minimize parsing * `onAddRoute` recreates the vpn service each time(TODO: is this too bad for performance?) * `on_add_route` and `onAddRoute` returns the new fd * on android after `on_add_route` we recreate `IfaceConfig` and `DeviceIo` and we store the new values * `peer_handler` now runs on a loop, where each time we fail a write with an error code 9(bad descriptor) we try to take the new `DeviceIo` * we keep an [`AbortHandle`](https://docs.rs/tokio/latest/tokio/task/struct.AbortHandle.html) from the `iface_handler` task, since closing the fd doesn't awake the `read` task for `AsyncFd`(I tried it, right now `close` is only called after dropping the fd) so we explicitly abort the task and start a new one with the new `device_io`. * in android `DeviceIo` has an atomic which tells if it's closed or open and we change it to closed after `on_add_route`, we use this as to never double-close the fd, instead we wait until it's dropped. This *might* affect performance on android since we use non-`Ordering::Relaxed` atomic operation each read/write but it won't affect perfromance in other platforms, furthermore I believe the performance gains if we remove this will be minimal. Fixes #2227 --------- Co-authored-by: Jamil <jamilbk@users.noreply.github.com>