RustDDS icon indicating copy to clipboard operation
RustDDS copied to clipboard

Update to use mio 0.8.x

Open fgadaleta opened this issue 2 years ago • 2 comments

fgadaleta avatar Jun 13 '22 07:06 fgadaleta

This is non-trivial, because we depend also on mio-extras crate to get mio-pollable channels, and that is not available for mio 0.7.x or 0.8.x, because of features dropped from mio. Can you make this change and submit a pull request?

jhelovuo avatar Jun 13 '22 12:06 jhelovuo

Hello. I found this issue might be related to a previous Windows Problem, so I think I could post a user response here.

Months ago I accidently made RustDDS run on Windows with a minor patch. But recently when I tried it on my Windows again, it failed to work (Actually I was using it on Raspberries Linux during these months so this feedback is so late).

I made some investigation and finally found it might be Windows OS bug, which was not dealed with well by mio 0.6 (refer to mio 0.7.0, Suspect Windows UDP operations, Fix for windows selector locking mechanism and Fix udp wrong wouldblock's handling ).

I'm not 100% sure of this, since at last I find this fix is not easy to be applied on mio 0.6.23. Old UdpSocket contains little historical config state.

// new, mio 0.7.0
pub struct UdpSocket {
    internal: Arc<Mutex<Option<InternalState>>>,
    io: net::UdpSocket,
}

// old, mio 0.6.0
pub struct UdpSocket {
    imp: Imp,
    registration: Mutex<Option<poll::Registration>>,
}

Just to let you know. Regards.

wangxiaochuTHU avatar Sep 08 '22 09:09 wangxiaochuTHU

Any thing I can do to help this move forward? Mio v0.6 is no longer supported (and hasn't been for a little while).

Thomasdezeeuw avatar Nov 12 '22 17:11 Thomasdezeeuw

The basic thing to do is to replace all uses of mio-0.6.x with mio-0.8 equivalents. This is otherwise straightforward, but mio-extras is only supported up to mio-0.6.x. There is a crate mio-misc , which could be used to replace mio-extras, but that need to be confirmed somehow. Can you answer if mio-misc is a suitable replacement and do any better alternatives exist?

mio-misc does not have much in the way of documentation, and its timer mechanism ("Scheduler") seems to have a non-trivial API.

While doing the upgrade, it would be also worthwhile to investigate if almost the same work could be used to bring some async support to RustDDS, so that the library users could use some async runtime (e.g. Tokio) to do asynchronous DDS operations instead of using .poll() from mio.

jhelovuo avatar Nov 16 '22 14:11 jhelovuo

RustDDS 0.8 supports both mio-0.6 and mio-0.8 at the API.

jhelovuo avatar May 09 '23 11:05 jhelovuo