bltavares / colmeia

Attempt to make an interop layer to connect to dat on hyperswarm in Rust
24 stars 4 forks source link

Boxable futures on mdns #30

Closed bltavares closed 3 years ago

bltavares commented 3 years ago

To allow extended usage of the operations, we need to allow them to become boxed.

For that, we need to convert then from async fn to impl Future so we can define it as 'static futures, which shows that we can't keep references to self.

To fix this, we have to convert them to async move closure, and use the Arc<RW> structures we already use to move them into the future.

This required us to change the API to accept a Vec<u8>, instead of allocating internally to allow moving to a static future.

This also required changes on the internal Mdns struct, but those should not be API changes.

bltavares commented 3 years ago

Merged on 53761799f7a9ee123875534e0108d7483a117885