Conversation
|
The basic idea is to create a oneshot, and put the |
1e6dc07 to
1f00947
Compare
src/lib.rs
Outdated
| ) where | ||
| F: FnOnce(Result<()>) -> Result<()> + 'static, | ||
| { | ||
| // unbox the callback function |
There was a problem hiding this comment.
Thanks I'll fix the comment :).
|
So the odd thing is that when I call this mount_async function in my test code it never calls the callback function I setup. I've tried all different variants and I can't seem to get it working. |
|
You need to get the fd from libnfs and plug it into Tokio's reactor so that it can respond to socket state changes. In principle this is straightforward, you "just" need to:
In practice its awkward because libnfs doesn't consume everything from the socket on each call to This is doubly awkward for |
|
@jsgf thanks that actually explains a lot of what I'm seeing. libnfs thinks everything is fine but it's not calling the callback fn. I'll work on getting the polling working with Tokio. Looking closer at the async example libnfs has on the repo: https://github.com/sahlberg/libnfs/blob/master/examples/nfsclient-async.c#L259 you're right they setup a poll which I'm missing. |
1f00947 to
aca4ae8
Compare
|
@jsgf so this gets slightly further but crashes when I try to call |
|
Ah ok I see what's going on. I tried reversing the order of calls here and it started working and then seg faulted later. Reading the mio docs helped. I need to setup a bunch of calls and then call setup_async last to run the tasks. |
aca4ae8 to
a4ff673
Compare
@mzhong1 so I was playing around with the async functionality of libnfs and I'm wondering if this would be ok to use. This would require the library user to setup a function for nfs to call you later with. It would look like:
Not sure if that'll be ok or annoying to use.
@jsgf you mentioned you did this with oneshot. Could you provide an example maybe? I'm scratching my head about how that would work.