mxinden / if-watch

Cross platform asynchronous network watcher
28 stars 26 forks source link

*: make IfWatcher::new synchronous #24

Closed elenaf9 closed 2 years ago

elenaf9 commented 2 years ago

Make IfWatcher::new synchronous. The only reason why it is currently async is because the linux implementation executed a AddressGetRequest in new to obtain the initial list of ip addresses. By chaining this stream together with the existing message stream we can make linux::IfWatcher::new sync and instead move the polling into the Stream impl. Motivation for this change is that IfWatcher::new being async currently causes some complexity in rust-libp2p. Concretely, it forces to wrap the IfWatcher in an enum [1] and first poll the future returned by IfWatcher::new [2] before we can poll the IfWatcher itself.

mxinden commented 2 years ago

@elenaf9 could you resolve the merge conflicts?

mxinden commented 2 years ago

@elenaf9 should I cut a release already, or do you expect other changes in the near future?

elenaf9 commented 2 years ago

@elenaf9 should I cut a release already, or do you expect other changes in the near future?

I am still looking into simplifying the IfWatcher integration in rust-libp2p. There may still be some minor changes coming. I will ping you once I am through and we can cut a release. Thanks!