meh / rust-tun

TUN device creation and handling.
340 stars 133 forks source link

feat: improving async and sync API #54

Open sabify opened 1 year ago

sabify commented 1 year ago

This pull request will remove the requirement for obtaining an unnecessary mutable reference to self in AsyncRead and AsyncWrite, as it is already protected by locks within the code. It will also include methods like send and recv in the async API that can be used concurrently by only sharing a reference to the queue.

The method queue will be replaced by queue_mut, as it is intended to be. Additionally, two more methods will be added: queue, which returns a reference to the queue, and queues, which transmute the device to the vector of its queues.

mtnking commented 1 year ago

This conceptually would resolve a lot of issues for me that currently require extensive work-arounds.

GyulyVGC commented 6 months ago

Seems a clean solution and it'd be really helpful also in my case @sabify

Do you know by chance if (and how) is possible to access the AsyncQueues given an AsyncDevice with the current crate API?