- Notifications
You must be signed in to change notification settings - Fork81
Improved tokio async implementation#67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Improved tokio async implementation#67
Uh oh!
There was an error while loading.Please reload this page.
Conversation
fpagliughi commentedJun 1, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Awesome! Thanks you. I was meaning to look at this for a while now, but haven't haven't been able to find the time. Your guess is correct: We had just merged in the oldtokio-socketcan crate, which hadn't been updated in a few years. So it definitely needed an update. I'll test this out ASAP. |
I have seen that there is a std::io::{Read, Write} implementation for the sync CanSocket. Would it be beneficial to also have the corresponding AsyncRead and AsyncWrite implementation for tokio? Futhermore I can move the tests for the tokio module to the integration tests folder like it is done for the async_io implementation. Is this ok? |
EliteTK commentedJun 5, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This is great! It's a breaking change and if it gets considered I might as well make my change breaking. To that end, I've included these commits in my PR so I can base my changes off of them. Also:
This would be wonderful as it would support doing a 👍 Happy to keep rebasing my changes on top of anything which happens in this PR. |
dlips commentedJun 5, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I just pushed the implementation of The tests for the tokio module could need some refactoring, and maybe moving to the tests folder because these are technically integration test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM
Uh oh!
There was an error while loading.Please reload this page.
Hello,
I was studying the tokio async implementation for the
CanSocket
/CanFdSocket
and noticed that the implementation seems out of date compared to what the current tokio API offers (using theAsyncFd
). Instead of having the intermediateEventedCanSocket
wrapper, which implements a mio event source, I directly used the appropriate functions on theAsyncFd
. I could not figure out why the mio event source was used as an intermediate wrapper. My only guess is that the code was merged from the tokio-socketcan crate, which wasn't updated for a long time, and was written against an older API of tokio/mio. If I am wrong here and the code was necessary for some reason, please let me know!When working on it, I also added a new method for reading a single frame asynchronously, which was only possible through the
Stream
trait before.I added two new test for the
read_frame
functions ofCanSocket
andCanFdSocket
and renamed the old one to reflect that they use the Stream interface.This PR includes a breaking change because the return type of the
write_frame
function changes, see code in the examples.